Somnath Muluk Somnath Muluk - 1 year ago 554
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+/, '');