29 lines
1.1 KiB
Text
29 lines
1.1 KiB
Text
Function IsNumeric(a$) {
|
|
def m
|
|
=val(false->boolean)
|
|
Try {
|
|
if islet then {
|
|
z=val(a$,letter$, m)
|
|
} else.if isnum then {
|
|
z=val(a$,number, m)
|
|
} else z=val(a$,"", m)
|
|
=m>len(a$)
|
|
}
|
|
}
|
|
Function IsIntegerNumeric(a$) {
|
|
def m
|
|
=val(false->boolean)
|
|
Try {
|
|
z=val(a$,"Int", m)
|
|
=m>len(a$)
|
|
}
|
|
}
|
|
|
|
Locale 1033 ' to use . as decimal, else we have to place 1033 or "." as second parameter
|
|
|
|
Print isNumeric("+1"), isNumeric("-1"), isNumeric("1+")=false, isNumeric("1-")=false
|
|
Print isNumeric(",1",","), isNumeric("1,",","), isNumeric(",0",","), isNumeric("0,", ",")
|
|
Print isNumeric(".1"), isNumeric("1."), isNumeric(".0"), isNumeric("0.")
|
|
Print isNumeric("+.1"), isNumeric("-1."), isNumeric(".12e+232"), isNumeric("0.122e10")
|
|
Print isNumeric("+.1a")=false, isNumeric("asasa1212")=false, isNumeric("1.2e43+23")=false, isNumeric("0.122e10")
|
|
Print isNumeric("1221.211.1221")=false, isNumeric("1221e1212")=false, isNumeric("1.2e4323")=false, isNumeric("-.122e-10")
|