25 lines
664 B
Text
25 lines
664 B
Text
string 0;
|
|
|
|
func IsNumeric(Str);
|
|
char Str;
|
|
[while Str(0) # 0 do
|
|
[if Str(0) >= ^0 and Str(0) <= ^9 then return true;
|
|
if Str(0) = ^$ then
|
|
[if Str(1) >= ^0 and Str(1) <= ^9 then return true;
|
|
if Str(1) >= ^A and Str(1) <= ^F then return true;
|
|
if Str(1) >= ^a and Str(1) <= ^f then return true;
|
|
];
|
|
Str:= Str+1;
|
|
];
|
|
return false;
|
|
];
|
|
|
|
int Strs, S;
|
|
[Text(0, "Are these strings numeric?^m^j");
|
|
Strs:= ["1", "3.14", "-100", "1e2", "NaN", "$af", "%1_1011", "rose", ". 3", "num9", "x$ 9", "x$ a"];
|
|
for S:= 0 to 12-1 do
|
|
[Text(0, if IsNumeric(Strs(S)) then "yes : " else "no : ");
|
|
Text(0, Strs(S));
|
|
CrLf(0);
|
|
];
|
|
]
|