Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Puzzling Comparison
Message
De
23/06/2020 15:33:31
 
 
À
23/06/2020 06:17:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01674994
Message ID:
01675001
Vues:
82
>In comparing a numeric field from a table against a character variable, I get unexpected results. For example...
>x='1234'
>y=1234 (numeric field from the table)
>
>I convert the numeric to character by...
>y=alltrim(str(y))
>
>for continuity sake, I do an alltrim on the character field too...
>x=alltrim(x)
>
>When I then do a compare of x and y, sometimes they're equal and sometimes they're not.
>
>It's probably something really basic that I'm missing, but I'm really puzzled.
>Any help, please?
>Rich Murillo

Potential "gotcha" is when comparing strings for equality using "=" rather than "==" when SET EXACT is OFF

There's also the "gotcha" when you're comparing numeric values for equality when floating point is involved.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform