开发者

javascript search and replace prefix zero

开发者 https://www.devze.com 2023-01-01 09:49 出处:网络
i have few numbers like 0011,0101,0123,1234,5245,0052,3265,0047,0124 How replace prefix zero only, like no number should start with zero ,

i have few numbers like

0011,0101,0123,1234,5245,0052,3265,0047,0124

How replace prefix zero only,

like no number should start with zero ,

exactly like

0011 should be 11 , 0101 should be 101 , 0123 should be 123

How to do this ?

Is开发者_Python百科 ther any javascript function there ,

Thanks


parseInt("0011", 10);

will return a Number with the value of 11. Note that the second argument is important, otherwise your zero-prefixed numbers would be interpreted as octal.

0

精彩评论

暂无评论...
验证码 换一张
取 消