Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bug in GetWordNum
Message
De
14/08/2017 10:35:48
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
À
13/08/2017 13:04:56
Walter Meester
HoogkarspelPays-Bas
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Divers
Thread ID:
01653264
Message ID:
01653283
Vues:
81
>>Hi All,
>>
>>After nearly an hour of screaming, I discovered the source to a recent issue.
>>There is a bug in GetWordNum(). If the string being searched begins with the delimiter, and you are requesting the first word, the function will return the Second word in the list.
>>
>>
>>? GetWordNum( "1,2,3", 1, ",")                     && returns "1"
>>? GetWordNum( ",2,3", 1, ",")                       && returns "2"
>>? GetWordNum( ",,3", 1, ",")                         && returns "3"
>>
>
>AFAIK, this is by design. If will return the nTh word. It will disregard empty words. For this reason I use STREXTRACT() in cases where empty words are possible

I think the origin of the behavior can be traced to extracting words from text files, where, back in the DOS days, the columns were often made by padding the strings with spaces. Poor man's formatting. Likewise, text justification was achieved by inserting spaces between words. And then a getwordnum() which would be sensitive to multiple spaces and return "" for each - well that would have pissed us all off back then, wouldn't it?

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform