Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A common tokenizer
Message
From
07/05/1999 14:37:09
 
 
To
07/05/1999 12:04:24
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00216097
Message ID:
00216176
Views:
24
>Hey all FoxPro users!
>I want comments on usefulness of following code:
>
>
>
>* Remember if you try to tokenize a common text string:
>* 1: Replace all tab characters with a space if needed
>* 2: If the delimiter is space, first trim and then strtran(Text,' ',' ') within a loop while ' ' $ Text before calling this function.
>
>* A common detokenizer:
>* Select a delimited token from a string
>
>Function TokenIx(Text,lMark,lIndex)
>* Parameteres :
>* Text = Input- string
>* lMark = Delimiter
>* lIndex = Index of token to output
>
> Private all like l*
> lCount = Occurs(lMark,Text) + 1
>
> If lCount < lIndex or lIndex < 1
> Return ''
> Else
> lStart = Iif(lIndex=1,1,At(lMark,Text,lIndex - 1) + 1)
> lLen = Iif(lIndex=lCount,Len(Text) + 1 - lStart, At(lMark,Text,lIndex) - lStart)
> Return Iif(lLen=0,' ',Substr(Text,lStart,lLen))
> Endif

You may want to look at the WORDS() and WORDNUM() functions in FoxTools; George Tasker wrote an extensive extended help file for FoxTools which can be downloaded from the Files section here on UT.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform