Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Numeric string or not?
Message
 
To
21/03/2001 19:26:14
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00487462
Message ID:
00487466
Views:
10
David,

Probably i'm missing something, but,
if x='1.2' then: type(x)='N'
if x='1.a' then: type(x)='U'

Hugo

>Is there a quick way to determine if a character string represents a legal numeric string (contains only digits and maybe a sign or .)?
>
>I've tried using type(),vartype() and evaluate(), but they don't give me quite the right thing.
>
>Suppose I have a variable NorC.
>
>If it contains the string '1.2' I want mytypefunc(NorC) to return 'N'
>If it contains the string 'A.1' or '1.A' I want mytypefunc(NorC) to return 'C'
>
>EVALUATE('NorC') returns a character string in both cases.
>EVALUATE(NorC) returns a numeric value in 1st case but gives an error in the second case.
>
>Combinations of vartype(),type() and evaluate() do not give what I want.
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform