Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Padded strings
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00600660
Message ID:
00600773
Vues:
18
>>Hi Cetin,
>>
>>It would return .f. if thisform.myprop is padded with spaces and set exact is ON.
>
>Sergey,
>
>This is a common misconception. SET EXACT ON causes the shorter string to be padded with spaces to equal the longer string before they are compared. == is the opnly operator that will actually test for exact equality. That is why I strongly recommend that set exact is never set to ON.
>
>
>lcVar1 = "John"
>lcvar2 = "John    "
>
>SET EXACT OFF
>? lcvar1 = lcVar2 && True
>? lcvar2 = lcVar1 && False
>
>SET EXACT ON
>? lcvar1 = lcVar2 && True
>? lcvar2 = lcVar1 && True
>
>* SET EXACT anyway you want
>? lcvar1 == lcVar2 && False
>? lcvar2 == lcVar1 && False
>
Good to know. I was always under impression that SET EXACT ON an '==' operator are equivalent. But it's not the case as you pointed out.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform