Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Who's right - me or VFP?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00991597
Message ID:
00994088
Views:
22
Terry,

I know this reply is a bit late in the thread but I wanted to document the comparison process completely in this thread for others to get down.

SET EXACT ON
Causes if the shorter string in a comparison to be padded with spaces to be equal in lenght to the longer string.

Two strings are compared by the = sign character for character until the string on the right of the = is exhausted, so;

"Jimmy" = "Jim" is True
"Jim" = "Jimmy" is False

The double equal sign == adds one more step to the comparison process, after the above comparison is complete the two strings are compared for length.

"Jimmy" == "Jim" is False
"Jim" == "Jimmy" is False

Many erroneously assume that SET EXACT ON and == are the same, they are NOT as you can see below;

lcStr1 = "Jim "
lcStr2 = "Jim"

SET EXACT OFF
?lcStr1 = lcStr2 && .T.
?lcStr1 == lcStr2 && .F.

SET EXACT ON
?lcStr1 = lcStr2 && .T.
?lcStr1 == lcStr2 && .F.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform