Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Displaying elements of strings in simple way howto
Message
From
14/02/2005 07:23:25
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8
Miscellaneous
Thread ID:
00986136
Message ID:
00986566
Views:
27
>Tore, perhaps you can advise me. I would have thought that:
>
>
cName = "Zakaria"
>lnLenCName = LEN( cName)
>DIMENSION aLetters( lnLenCName)
>FOR i = 1 to lnLenCName
>  aLetters[ i] = SUBSTR( cName, i, 1)
>  ? aLetters[ i] +  CHR(13)
>ENDFOR
>
>would have been marginally faster (more so if a huge string), but at least more efficient, as LEN( cName) only has to be evaluated once, and not once then also every time through the loop. Perhaps this doesn't matter with for loops?
>
>Terry
>
cName = "Zakaria"
DIMENSION aLetters( LEN( cName))
FOR i = 1 to ALEN(aLetters) && ALEN(aLetters) IS faster respect to a lnLenCName read
  aLetters[ i] = SUBSTR( cName, i, 1)
  ? aLetters[ i] +  CHR(13)
ENDFOR
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform