I have the following numeric string where I need to add a decimal to the last two numbers.
So
300000
Becomes
3000.00
Can someone please help me out here, which regex code should I use for this? Or should I not use regex at all for this.
Thanks
var str="300000";
var resStr=str.substring(0,str.length-2)+"."+str.substring(str.length-2);
document.write(resStr);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With