Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

print a number with commas as thousands separator

Example: 10000000.2345 -> '1,000,000.2345'
function numberWithCommas(x) {
    var parts = x.toString().split(".");
    parts[0] = parts[0].replace(/B(?=(d{3})+(?!d))/g, ",");
    return parts.join(".");
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #print #number #commas #thousands #separator
ADD COMMENT
Topic
Name
1+1 =