Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What to use, SET EXACT ON or ==?
Message
 
À
16/02/2007 11:56:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01196479
Message ID:
01196658
Vues:
9
>That's exactly why I set it ON. I'm scared with a possibility that Seek will give wrong (i.e. not exact) match, and I don't like padding every time I use Seek.

One more comment, SET EXACT ON and using = is NOT the same as using ==;
lcStr1 = "John"
lcStr2 = "John   "
SET EXACT ON
? lcStr1 = lcStr2 && Returns .T.
SET EXACT OFF
? lcStr1 == lcStr2 && Returns .F.
This is because == compares the left to the right one char at a time and when the right is exhausted it checks the legnth of the two strings for a match. SET EXACT ON first pads the shorter string with spaces and then compares each char one by one, so if the only difference between the two strings is trailing spaces then SET EXACT ON does NOT guarantee an exact comparison.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform