Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Extract a Word
Message
From
12/07/2001 08:15:50
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00529297
Message ID:
00529619
Views:
14
>The drawback i see in wordnum is that it ignores repetition of delimiter, for example:
>
>
? wordnum('aas,bbb,ccc', 2, ',')  --> bbb
>
? wordnum('aas,,bbb,ccc', 2, ',') --> bbb
>
>I would expect to receive the empty string as a result of the second function call.
>
>Hugo

The reason is simple: WordNum() counts words, not parameters! WordNum() is designed, by default, to eliminate all white space: not only spaces, but also tabs and carriage returns. Thus, it is not specifically designed to extract parameters.

Since this is not what either you or I need, I think it is preferable to write your own extraction function, or, for a quick-and-dirty solution, to replace commas with carriage returns, and use either mline() + mlines() + _mline, or alines().

Hilmar.
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