Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IsNumeric - VFP analogue?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00307922
Message ID:
00307984
Vues:
89
>George,
>
>There is no contradiction;
>
>lcVar = "123"
>
>lcVar is now a character expression, it is a character data type holding a string. If I ask TYPE() to tell the me value of the expression in that string it is numeric. Because type evaluates this way;
>
>TYPE(lcVar)
>lcVar = "123"
>The type of 123 is N
>
>Using TYPE(lcVar) is exactly the same as saying TYPE("123") because lcVar IS "123"
>
>Now the following doesn't work;
>
>lcVar = "ABC"
>TYPE(lcVar)
>
>Because the expression lcVar evaluates to ABC and that is not an expression unless it is the name of a field or variable. So the answer is U undefined.
>
>Analogous to this is the situation when someone thinks they need to compare a logical variable with a logical constant to get a valid expression. You don't, a logical expression IS a logical value just as a character variable is a character expression.

Jim,

It just seems to me that the documentation indicates that it (the parameter) must be a character string: "The expression must be passed as a character string." Passing a variable without the quotes is not passing a character regardless of the variable's contents.

What I think is happening here is that because the variable happens to be character (when containing just numbers) evaluates properly. However, when containing just letters it does not.

If I were to describe this, I wouldn't call it a bug, but I would call it a "feature". Under the circumstances, I still hestiate to rely on this in the future.

Agree?
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform