Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
String to Array
Message
 
À
31/01/2001 10:02:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00470612
Message ID:
00470620
Vues:
32
>I have a string similar to "text1,text2,text3,etc...". I want to be able to break out each item and store to an array (i.e. STORE "text1" to lArray(i)).
>What is the fastest and easiest way to do this?
>
>Thanks in advance for your help,
Russell,

You can of course use OCCURS(",", lcstring) + 1, then AT() to determine the position etc. I'm sure someone will recommend that. I will, however, recommend the following:
* Assumes Foxtools is one the search path
SET LIBRARY TO FOXTOOLS ADDITIVE
lcstring = "text1,text2,text3"
lnwords = Words(lcstring, ",")
DIMENSION myarray[lnwords]
FOR lni = 1 TO lnwords
  myarray[lni] = WordNum(lcstring, lni, ",")
NEXT
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform