Somnath Muluk Somnath Muluk - 1 year ago 664
Javascript Question

Remove/ truncate leading zeros by javascript/jquery

Suggest solution for removing or truncating leading zeros from number(any string) by javascript,jquery.

Answer Source

You can use a regular expression that matches zeroes at the beginning of the string:

s = s.replace(/^0+/, '');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download