Jump to content

Determine if a string is numeric: Difference between revisions

no edit summary
(→‎{{header|Common Lisp}}: numberp is insufficient as it doesn't take strings; added 2 parsing options)
No edit summary
Line 108:
⊃⎕VFI{w←⍵⋄((w='-')/w)←'¯'⋄w}'152 -3.1415926 Foo123'
1 1 0
 
=={{header|AutoHotkey}}==
AutoHotkey has no explicitly defined variable types. A variable containing only digits (with an optional decimal point) is automatically interpreted as a number when a math operation or comparison requires it.
<lang autohotkey>list = 0 .14 -5.2 ten 0xf
Loop, Parse, list, %A_Space%
MsgBox,% IsNumeric(A_LoopField)
return
 
IsNumeric(x) {
If x is number
Return, 1
Else Return, 0
}
 
;Output: 1 1 1 0 1</lang>
 
=={{header|AWK}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.