Isnum()

From TinyMUX
Jump to navigation Jump to search


isnum(<string>)

This function will return 1 (TRUE) if the argument is a valid number and 0 (FALSE) otherwise. This definition of a number includes scientific notation as well as a certain case-insensitive 'special words': NaN, -Inf, +Inf, and Ind.

You can test more restrictively with israt() or isint().

Example

> say isnum(22223.0000)

You say "1"

> say isnum(10E-20)

You say "1"

> say isnum(+77)

You say "1"

>say isnum(+Inf)

You say "1"

> say isnum(22 L)

You say "0"

>say isnum(Bad Numbers!)

You say "0"

Related Topics

BOOLEAN VALUES, isdbref(), isint(), israt(), isword()