Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
String parsing
Message
De
08/10/1999 22:51:07
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00273042
Message ID:
00274533
Vues:
53
I guess this would work too but alines() is a luxury for VFP6 users. VFP3-5 doesn't have it. OTOH limited to array limit (65000 currently).
Cetin

>Charlie,
>
>>I guess it depends on your application. If you pass me a string with ",," embedded in it, I would assume that you intend for one of the elements to be empty. If it turns out that empty has no meaning, you can handle that case with more logic. My reason for mentioning the STRTRAN/ALINES technique is that it's the easiest way to separate a string and stuff an array.
>
> Ok, let's assume first that we have a string with single Delimiter, so, comparing with Cetin's approach which would be fastest? And are you sure that you method will work with huge string?
>>
>>
>>>Charlie,
>>>
>>>
>>>>Here's another technique for parsing strings.
>>>>
>>>>Replace the commas with CHR(13) using STRTRAN.
>>>>String = STRTRAN(m.String,',', CHR(13))
>>>>Now put each element in an array.
>>>>ALINES(aStrings, m.String)
>>>>FOR EACH String IN aStrings
>>>>   * Do something with each m.String.
>>>>ENDFOR
>>>>
>>>
>>>It's interesting but not universal enough. What we can do if we have 2 commas ,(for example: "I,,the,12,etc.,," there a comma is an isolate case of a delimiter? We don't want to have additional empty members of array.
Ç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