Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Numeric string or not?
Message
De
21/03/2001 20:28:40
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00487462
Message ID:
00487480
Vues:
7
>Probably i'm missing something, but,
>if x='1.2' then: type(x)='N'
>if x='1.a' then: type(x)='U'


This almost works but fails in subtle cases.

Suppose:

a123 = 456

if x='123' then: type(x) = 'N'
if x='a123' then: type(x) = 'N' (undesirable result)

Problem is, if there is a variable in scope whose name is the same as the string in x, type() returns the type of that variable....Nasty!

I'm thinking there might be a way to use the TRANSFORM() function to distinguish between the two cases, but I haven't figured it out yet.
"The Iron Fish: The water is cold...but the fish don't mind"
...Jay Jenks, boyhood chum
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform