Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Any value = blank value
Message
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00175973
Message ID:
00176029
Views:
32
>Is this still true?
>
>oldvalue = ""
>value = "anystring"
>
>oldvalue = value (returns .T.)
>
>I thought this problem was fixed long ago, but I just ran across a situation where it appears the problem was not fixed.
>
>I SET EXACT ON still the cure?
>
>regards,

James,

This is not a problem it is the desing of string comparison. The strings are assumed to be equal, then they are compared character by character until the shorter string is exhausted and the result is returned. Everything is equal to the empty string because the empty string has no length.

You can SET EXACT ON and that will pad the shorter string to be equal in length with the longer one using spaces adn then do the comparison. However,

"Jones " = "Jones"

will be true even with set exact on. A better solution is to use the double = operator when you need exact comparison. It does the comparison and then compares the string lengths, so;

"Jones " == "Jones" is false

If you choose to SET EXACT ON partial matching with SEEK will no longer work, as in;

lcName = "Smi"
SEEK lcName

will not find anything unles the length of the field is three.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform