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:
00176052
Views:
29
>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.

James and David,

OK, I can see how it would be necessary in the scheme of string comparisons that "" = "anything". But I somehow had gotten the impression that x # y for sting comparisons when either x or y were empty and the other has a non-blank value. Must have been Clipper or xBase.

You are right about ==. I use it most of the time. But in this particular instance I could not since I needed to test whether the significant part of x = the significant part of y, disregarding trailing spaces.

Anyway, it's fixed now. The workarounds are obvious.

Thanks for your replies,
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.com

No trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform