Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Wishlist new GETWORDPOS function
Message
From
03/04/2003 05:07:38
 
 
To
03/04/2003 03:23:44
Walter Meester
HoogkarspelNetherlands
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00773434
Message ID:
00773447
Views:
14
Hello Walter


Yes I have used a similar function to the 2 you describe for years.

However I use the one function to do both jobs.
If I send an index number then the function send back a word.
If I send a word then the function sends back an index number :)


It just looks at the type of the parameter being searched for and works out what is required from there.

So I would like to see the following

? GETWORDNUM('apple orange pear', 2)
orange

? GETWORDNUM('apple orange pear', 'pear')
3

I think the description GETWORDNUM works quite well both ways


What do you think?





>Just as I pointed out in TIP of the Day: GETWORDNUM Thread #773431 Message #773431 how valuable the GETWORDNUM function is, I feel there is a need for the GETWORDPOS function.
>
>
>GETWORDPOS(cSearchWord, cString, cDelimiter)
>
>This function should return the number of the word in cString which matches cSearchWord. At default a words are seperated by spaces, tabs, carriage return or linefeeds (As with GETWORDNUM). You can change this by specifying cDelimiter
>
>
>Examples:
>
>
GETWORDPOS("Walter","Hello my name is Walter")
>should return 5 as walter is the 5th word in the string.
>
>
GETWORDPOS("BIKE","TRACTOR|PLANE|CAR|BIKE|BOAT","|")
>should return 4 as BIKE is the 4th word where the words are delimited with a |
>
>If cSearchWord is not found, the function should return 0
>
>
>Well, what do you think ?
>
>Walter,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform