Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String parsing
Message
 
 
To
07/10/1999 11:34:48
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00273042
Message ID:
00274022
Views:
40
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform