I have a textbox in Javascript. When I enter \'0000.00\' in the textbox, I want to know how to convert that to only having one leading zero, such as \'0.0
\'0000.00\'
\'0.0
str.replace(/^0+(?!\.|$)/, '') '0000.00' --> '0.00' '0.00' --> '0.00' '00123.0' --> '123.0' '0' --> '0'