Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Who's right - me or VFP?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
00991597
Message ID:
00994088
Vues:
20
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform