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:
00307966
Vues:
63
>>>George,
>>>
>>>IsDigit() checks only first symbol, so it's not suitable for my situation. Type() works fine.
>>>
>>>Example:
>>>
>>>myNumber='12345'
>>>type(myNumber)='N'
>>>isDigit(myNumber)=.t.
>>>
>>>myNumber='1hffhhf'
>>>type(myNumber)='U'
>>>isdigit(myNumber)=.t.
>>
>>Nadya,
>>
>>This behavior is not in accordance with the docs. Whether or not it's a bug, I don't know.
>
>George,
>
>It is not a bug and it is in accordance with the docs. The TYPE() function returns the data type for an expression, any expression.
>
>TYPE("12x12") = N
>TYPE(FOUND()) = L
>etc.
>
>So when we do;
>
>Var = "12345"
>TYPE(var)
>
>we are gfetting teh type of the contents of var which is numeric, the type of the variable named var is character (note the quotes in the assignment line).
>
>Another method that would work is;
>
>STR(VAL(Var),LEN(Var)) = Var
>
>Although some numeric strings would fail the test.
>
>VarType() would not work here because it is the value inside the var that Nadya wants the type for, not the var itself.

Hi Jim,

I'm not so sure about this. For the sake of all concerned. Here's the description from the documentation:
cExpression

Specifies the expression to be evaluated, which can be a variable, field, memo field, or any other expression. The expression must be passed as a character string; place quotation marks around the names of memory variables, fields, and so on. If you do not place quotation marks around the expression, the TYPE( ) function returns "U" (undefined expression).


First the cExpression indicates a character expression not a variable or or type. Next the sentence that I've placed in bold type seems to contradict what you just said. Or do I need remedial reading< g >?
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