NumberFormat

From Second Life Wiki
Revision as of 05:47, 4 May 2007 by Fox Diller (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

string llNumberFormat(integer)

string llNumberFormat(integer number)
{
    string output;    
    integer x;
    integer z;
    string numberString = (string)number;
    integer numberStringLength = llStringLength(numberString);
    
    if ((numberStringLength % 3) == 2) z = 1;
    else if ((numberStringLength % 3) == 0) z = 2;
    
    for(x=0;x<numberStringLength;x++)
    {
        output += llGetSubString(numberString, x, x);
        if ((x % 3) == z && x != (numberStringLength - 1))
            output += ",";
    }
    
    return output;
}