Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- numberToComma(numtoconvert)
- {
- x = string(numtoconvert);
- formatted = "";
- if(x.size <= 3)
- return numtoconvert;
- for( i = x.size - 3; i >= 0; i -= 3 )
- {
- if ( i > 0 )
- formatted += "," + getsubstr(x, i, 3 + i);
- else
- formatted += getsubstr(x, i, 3);
- }
- if ( i < 0 )
- formatted = getsubstr(x, 0, 3 + i) + formatted;
- return formatted;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement