views:

34

answers:

2

Hi ,

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 ther any javascript function there ,

Thanks

+4  A: 
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.

Matti Virkkunen
great super...very simple...
Bharanikumar
A: 
var str = "0011";
str = str.replace(/^0*/, "");
jAndy