hershf at rgllc.us
Thu Nov 16 19:44:18 EST 2006
On 11/16/06 7:10 PM, "John Craig" <jc at spl21.net> wrote:
> Say we have a 10 digit number called tInt - 1234567890
> repeat with i = length(tInt) - 3 to 1 step -3
I got it, a reverse repeat by 3.
I was wondering for a while how to do a reverse repeat, I got it.
> 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.
>> it did, very nice code.
>> Just don't understand the repeat header.
>> "to 1 step -3"
>> Thanks, Hershel
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
More information about the Use-livecode