Difference between revisions of "NumberFormat"
Jump to navigation
Jump to search
Huney Jewell (talk | contribs) (Add tags to show entry in TOC) |
Huney Jewell (talk | contribs) m |
||
Line 23: | Line 23: | ||
</pre> | </pre> | ||
{{LSLC|Examples}} | |||
{{#vardefine:sort| | {{#vardefine:sort|llNumberFormat}} |
Revision as of 04:48, 7 September 2007
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
string llNumberFormat(integer)
You can use this to take large numbers and format it to be comma seperated by thousands.
string llNumberFormat(integer number) { string output; integer x = 0; string numberString = (string)number; integer numberStringLength = llStringLength(numberString); integer z = (numberStringLength + 2) % 3; for(;x < numberStringLength; ++x) { output += llGetSubString(numberString, x, x); if ((x % 3) == z && x != (numberStringLength - 1)) output += ","; } return output; }