Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GetWordNum() bug with chr(0)
Message
From
05/04/2002 10:38:23
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00639016
Message ID:
00641447
Views:
21
And this suggests strongly that the generally held assumption that FoxTools stuff was moved over to "native" with only cosmetic revisions is incorrect.


>Looks like a bug to me too.
>
>>GetWordNum() and GetWordCount() don't seem to accept chr(0) as a word separator, while corresponding old functions in FoxTools still do:
>>
>>
x=STUFF(REPLICATE("x",33),13,0,CHR(0))
>>?x
>>?GETWORDNUM(x,1, CHR(0))
>>* both return the same, all 34 characters
>>?GETWORDCOUNT(x,CHR(0))
>>* returns 1
>>* With FoxTools:
>>?WORDnum(x,1, CHR(0))
>>* returns 12 chars
>>?WORDnum(x,2, CHR(0))
>>?GETWORDNUM(x,2, CHR(0))
>>* both return empty strings
>>?WORDs(x, CHR(0))
>>* also returns 1
>>
>>* now we give it two null chars
>>x=STUFF(STUFF(REPLICATE("x",33),13,0,CHR(0)), 22,1,CHR(0))
>>?WORDs(x, CHR(0))
>>?GETWORDCOUNT(x,CHR(0))
>>* both return 1
>>?WORDnum(x,2, CHR(0))
>>?GETWORDNUM(x,2, CHR(0))
>>* both return empty strings
>>
>>
>>So, FoxTools is just a little better here - it will return the first word correctly. Since FoxTools in VFP7 is actually a recompiled leftover from VFP6, I expect the results under 6 to be the same.
Previous
Reply
Map
View

Click here to load this message in the networking platform