Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parsing a text string
Message
De
15/02/2003 05:38:14
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
14/02/2003 22:09:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00753613
Message ID:
00753657
Vues:
24
>Is there a function where you can take a string which is delimited and convert the values in a string into an array. ex "2222 3333 4444 5555"?
>
>I thought I saw something on the board in the past but haven't been able to find it. I have use at() and atc()in the past and would like a more simplier method if possible.
>
>Thanks
>Gaylen

Gaylen,
Version ?
*VFP7 and up
tcStr = "2222 3333 4444 5555"
alines(arrVals, tcStr, " ")

*VFP6 and up
tcStr = "2222 3333 4444 5555"
alines(arrVals, chrtran(tcStr, " ",chr(13)))

*Older - for short lists this was fastest as I could see
tcStr = "2222 3333 4444 5555"
tcStr = chrtran(tcStr, " ",",")
oDummy = createobject('Listbox')
with oDummy
  .RowSourceType = 1 && Value
  .RowSource = tcStr
  dimension arrVals[.ListCount]
  for ix=1 to .ListCount
    arrVals[ix] = .List(ix)
  endfor
endwith
release oDummy
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform