Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Displaying elements of strings in simple way howto
Message
De
14/02/2005 07:23:25
 
 
À
14/02/2005 06:44:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8
Divers
Thread ID:
00986136
Message ID:
00986566
Vues:
28
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform