Difference between revisions of "NumberFormat"
Jump to navigation
Jump to search
Fox Diller (talk | contribs) |
(Strange function but i couldn't resist doing a small optimization (equivalent but faster)) |
||
Line 4: | Line 4: | ||
{ | { | ||
string output; | string output; | ||
integer x | integer x = 0; | ||
string numberString = (string)number; | string numberString = (string)number; | ||
integer numberStringLength = llStringLength(numberString); | integer numberStringLength = llStringLength(numberString); | ||
integer z = (numberStringLength + 2) % 3; | |||
for(;x < numberStringLength; ++x) | |||
for( | |||
{ | { | ||
output += llGetSubString(numberString, x, x); | output += llGetSubString(numberString, x, x); |
Revision as of 08:13, 4 May 2007
string llNumberFormat(integer)
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; }