Determine if a string is numeric: Difference between revisions

Added Quackery.
No edit summary
(Added Quackery.)
Line 3,399:
"inf" -> inf <class 'float'> is_numeric: True str.isnumeric: False
"-Infinity" -> -inf <class 'float'> is_numeric: True str.isnumeric: False</pre>
 
=={{header|Quackery}}==
 
<lang Quackery> [ char . over find
tuck over found iff
[ swap pluck drop ]
else nip ] is -point ( $ --> $ )
[ -point $->n nip ] is numeric ( $ --> b )
[ dup echo$ say " is"
numeric not if say " not"
say " a valid number." cr ] is task ( $ --> )
$ "152" task
$ "-3.1415926" task
$ "Foo123" task</lang>
 
{{out}}
 
<pre>152 is a valid number.
-3.1415926 is a valid number.
Foo123 is not a valid number.</pre>
 
=={{header|R}}==
1,462

edits