clear >lcfoo = 'ABCDEF' >lnstart = SECONDS() >FOR lnj = 1 TO 10000 > lcresult = "" > FOR lni = 1 TO 6 > lcresult = SUBSTR(lcfoo, lni, 1) + lcresult > NEXT >NEXT >lnstop = SECONDS() >? lnstop - lnstart && Faster > >lnstart = SECONDS() >FOR lnj = 10000 TO 1 STEP -1 > lcresult = "" > FOR lni = 6 TO 1 STEP -1 > lcresult = SUBSTR(lcfoo, lni, 1) + lcresult > NEXT >NEXT >lnstop = SECONDS() >? lnstop - lnstart && SlowerI ran this test enough times to be convinced that the first instance was always going to be faster (by about 2%). NBD. What was interesting was that the second nested iteration structure had to be changed. Originally, the lnj variable was incremented. I got an error message and had to change it to the above.
lcresult = lcresult + SUBSTR(lcfoo, lni, 1)
<\PRE>
Or am I blind? <G>Bill Armbrecht
VFP MCP