Table of Contents

# $EPIC: isnumber.txt,v 1.2 2006/08/01 03:40:36 sthalik Exp $

Synopsis:

$isnumber(<text>)
$isnumber(b<base-num> <text>)
$isnumber(<text> b<base-num>)

Technical:

Practical:

Wow. That's complicated. This function (believe it or not) just tells you whether or not <text> is a number. You can specify a number base (such as b8, or b16) to see if <text> is a number in a base other than base 10. This is neccesary if you want to octal or hexidecmial numbers for validity.

Returns:

1 if <text> is a valid number of base <base-num>; 0 if not.

Examples:

$isnumber(10)             returns 1
$isnumber(hello)          returns 0
$isnumber(0xdeadbeef)     returns 1  (all hex digits!)
$isnumber(b8 0xdeadbeef)  returns 0  (not an octal number!)
$isnumber(b8 07f932)      returns 0  (9 is not an octal digit!)
$isnumber(3.4)            returns 1
$isnumber(b16 a.f)        returns 1
$isnumber(a.f)            returns 0  (hex digits invalid without 0x)
$isnumber(0xa.0)          returns 1
$isnumber(b16 a.f)        returns 1  (hex digits valid with b16)