Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How Do I
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
Divers
Thread ID:
00180248
Message ID:
00180384
Vues:
25
>What I'm about to write is more for newcomers to VFP (and myself < g >) than you.
>
>Consider the following code snippet:
>SET EXACT OFF
>? 'X' = 'XX' && returns .F.
>? 'XX' = 'X' && returns .T.
>? 'XX' = 'XX' && returns .T.
>? 'X' == 'XX' && returns .F. again
>? 'XX' == 'X' && returns .F. this time
>? 'XX' == 'XX' && .T., of course.
>What happens is that when SET('EXACT') is equal 'OFF' if the string expression on the right of the equal contains more characters than the one on the left, the comparison only goes as far as the number of characters in the string on the left. If the string on the left contains more characters than the one on the right, then the strings are automatically unequal regardless of the number of character matches.

Your code sample is correct, but in your text you reversed left and right. If the string on the RIGHT has more characters than the string on the LEFT, it's always unequal (regardless of SET EXACT, =, or ==). If the string on the LEFT has more characters than the string on the RIGHT, if SET EXACT is off and single = is used, the comparison only goes to the length of the string on the RIGHT.

HTH,
Rich Addison, Micro Vane, Inc., Kalamazoo, MI
Relax, don't worry, have a homebrew.
- Charlie Papazian, The New Complete Joy of Home Brewing
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform