Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Extract a Word
Message
From
11/07/2001 14:12:10
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
11/07/2001 14:04:33
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00529297
Message ID:
00529313
Views:
14
Thank you. For the other part (WorNum()), I would have to use at() (twice) and substr(), I think.

Actually, I thought there was a built-in function. I think there is one in FoxTools (I also have similar functions in the framework I am using, Visual Extend), but for a small stand-alone program I am building, I prefer to write my own small function.

Regards, Hilmar.

>>Is there a quick way to extract a "Word" from a string? I thought there were functions similar to WordCount() and WordNum(), but I can't find them.
>>
>>The idea is to do something like this:
>>
>>
>>MyString = "Option 1;Option 2;Option3"
>>for i = 1 to WordCount(MyString, ",")
>>  ? WordNum(MyString, i, ",")
>>next
>>
>
>Try this:
>
>
>FUNCTION ParmCnt
>* Return the number of parameters in a list
>* expC1 Parameter list
>* expC2 Delimiter (default is the comma)
>PARAMETER tcParms,tcDelimiter
>LOCAL lcDelimiter
>IF TYPE('tcDelimiter')<>'C'
>   lcDelimiter=','
>   ELSE
>   lcDelimiter=tcDelimiter
>ENDIF
>RETURN IIF(EMPTY(tcParms),0,OCCURS(lcDelimiter,tcParms)+1)
>
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform