Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Alltrim strange behavior
Message
 
To
25/04/1999 11:08:55
Christian Cote
Les Logiciels Onoma Inc.
Longueuil, Quebec, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00212015
Message ID:
00212026
Views:
32
Christian,

The others have shown you how to get what you want, let me explain why you are getting what you are.


ALLTRIM(Field) = ALLTRIM(Value)

The alltrims remove all spaces from a value, so if the field is empty it becomes equal to ''. In strong comparison, VFP matches on partials by stopping the comparison as soon as one of the values is exhausted, so with '' on one side (the field is empty) there is a match for any value on the other side.

As an example;
lcVar1 = "Smith"
lcVar2 = "Smi"
lcVar3 = ""
? lcVar1 = lcVar2 && T they are "equal"
? lcVar1 = lcVar3 && T they are "equal"
lcVar4 = "This is a test of a ery long string with alot of stuff in it"
? lcVar4 = lcVar4 && T they are "equal"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform