Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert a delimited string to an array
Message
De
07/09/1999 05:20:52
Schabbach Stefan
Software Für Das Handwerk
Trier, Allemagne
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00259451
Message ID:
00261875
Vues:
21
Hello Scott !

Hiere are 2 other solutions for your Problem:

*** 1st Solution via SUBSTR
cString = "123 12 456 123456 123, 32,99 999, 88 777777,,123,"
cDelimiter = ","
nElements = OCCURS( "," , cString )
DIMENSION cArray( nElements )
FOR ij = 1 TO nElements
cArray( ij ) = SUBST( cString , AT( cDelimiter , cDelimiter + cString , ij ) , AT( cDelimiter , cDelimiter + cString , ij +1 ) -AT( cDelimiter , cDelimiter + cString , ij ) -1 )
? cArray( ij )
ENDFOR


*** 2nd Solution via MEMLINES
cString = "123 12 456 123456 123, 32,99 999, 88 777777,,123,"
cDelimiter = ","
cNewstring = CHRTRAN( cString , cDelimiter , CHR(13) )
nElements = MEMLINES( cNewstring )
DIMENSION cArray( nElements )
FOR ij = 1 TO nElements
cArray( ij ) = MLINE( cNewstring , ij )
? cArray( ij )
ENDFOR
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform