Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Extract a Word
Message
De
12/07/2001 08:15:50
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00529297
Message ID:
00529619
Vues:
16
>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)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform