Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
String parsing
Message
 
 
À
07/10/1999 11:34:48
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:
00274022
Vues:
39
Cetin,
>> We have this program in our library.
>>
>>*!******************************************************************************
>>FUNCTION aparser
>> * Description.......: Function parses a text string into an array.
>> * : Each element of the array contains one word...
>> * Calling Samples...: dimension laWords[1]
>> * : lcWordString = "Some text string"
>> * : lnWords = aparser(@laWords, lcWordString)
>> * Parameter List....: paWords, pcWordString, pcDelimiter
>> ********************************************************************
>> lparameter paWords, pcWordString, pcDelimiter
>> local lnWords, lni
>> external array paWords
>>
>> if not "FOXTOOLS.FLL" $ set("library")
>> set library to foxtools.fll additive
>> endif
>>
>> pcDelimiter = iif(empty(pcDelimiter), space(1), pcDelimiter)
>>
>> lnWords = Words(pcWordString, pcDelimiter)
>>
>> IF lnWords>0 && Not empty string
>> dimension paWords[lnWords]
>>
>> for lni = 1 to lnWords
>> paWords[lni] = WordNum(pcWordString, lni, pcDelimiter) && Array of words
>> endfor
>> ELSE
>> dimension paWords[1] && For empty string lnWords=0
>> paWords[1]=""
>> ENDIF
>> return lnWords
>>
>>In you case Delimiter will be ','.
>>
>>HTH
>
>
FYI: Doing parsing with lowlevel instead of foxtools word* functions rewards you with speed :) Even another parser fll is faster because it uses the logic that it doesn't have to rewind each time it has to find next word as foxtools does.
>Tested speed is about 1Mb/sec (parse, sort, get into array + into a cursor - K6-2-333 64Mb).

If I understand you correctly, you think that our approach is slower than others. I totally agree. Actually, this is not the program I created, we already had this in our program libraries, I just use it.

For my regret, I didn't see the whole thread and I'm not a PUTM, so I don't know what you and others suggested. If you know better method just give me the code, please.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform