javascript search and replace prefix 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.
精彩评论