Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js format indian price with commas

var x=12345678;
    x=x.toString();
    var lastThree = x.substring(x.length-3);
    var otherNumbers = x.substring(0,x.length-3);
    if(otherNumbers != '')
        lastThree = ',' + lastThree;
    var res = otherNumbers.replace(/B(?=(d{2})+(?!d))/g, ",") + lastThree;
    alert(res);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #format #indian #price #commas
ADD COMMENT
Topic
Name
5+9 =