Say we have a 10 digit number called tInt -   1234567890

repeat with i = length(tInt) - 3 to 1 step -3

We start at length(tInt) - 3 (position 7) and put a comma after the character at position 7
This gives us 1234567,890

The next iteration (-3) takes us to position 4 - put in another comma;
Now we have 1234,567,890

Same again, takes us to position 1;
Now we have 1,234,567,890

The last iteration takes us to position -2. If we added a comma here, it would appear near the end of the string!
So we add the condition;
if i > 0 then put "," after char i of tInt

the condition takes care of any strings which aren't exact multiples of 3.

:-)
JC

it did, very nice code.
Just don't understand the repeat header.
"to 1 step -3"
Thanks, Hershel


_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to