Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Numeric string or not?
Message
From
22/03/2001 10:16:52
 
 
To
21/03/2001 19:26:14
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00487462
Message ID:
00487592
Views:
12
>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.

Check out the ISDIGIT function(). You'll have to loop to use it, but it's a start.

Tamar
Previous
Reply
Map
View

Click here to load this message in the networking platform