is numeric / integer - Functions

Prev Next

Function Names

is numeric, is integer, is numeric or blank, is integer or blank, is strictly numeric, is strictly integer, is strictly numeric or blank, is strictly integer or blank

Description

is numeric returns true if the value provided is a numeral
is numeric or blank returns true if the value provided is a numeral or a blank string.
is integer returns true if the value provided is a whole number (aka integer)
is integer or blank returns true if the value provided is a whole number (aka integer) or a blank string.
is strictly numeric returns true if the value provided is a numeral
is strictly numeric or blank returns true if the value provided is a numeral or a blank string.
is strictly integer returns true if the value provided is a whole number (aka integer)
is striclty integer or blank returns true if the value provided is a whole number (aka integer) or a blank string.


Attention: If the function name does not contain the word strictly, then strings containing legitimate numbers with and without decimal point, minus sign and scientific notation (exponents) are also considered as numbers.

Call as: function

Restrictions

Indirect parameter passing is disabled

Parameter count

1

Parameters

No.TypeDescription
1
input
valid types Value

Value to check.

Return value

TypeDescription
boolean Result

true if criteria is met.

Examples

      for all parameters( { 1, '1', 1.1, '1.1', '1.1E+03', '1.1234E+03', '', ' ', 'a' }, p[] )
      {
          print(p[],": is ");
          if (is numeric(p[])) print ("numeric, ");
          if (is strictly numeric(p[])) print ("strictly numeric, ");
          if (is integer(p[])) print ("integer, ");
          if (is strictly integer(p[])) print ("strictly integer, ");
          if (is numeric or blank(p[])) print ("numeric or blank, ");
          if (is strictly numeric or blank(p[])) print ("strictly numeric or blank, ");
          if (is integer or blank(p[])) print ("integer or blank, ");
          if (is strictly integer or blank(p[])) print ("strictly integer or blank, ");
          echo;
      }

Output

1: is numeric, strictly numeric, integer, strictly integer, numeric or blank, strictly numeric or blank, integer or blank, strictly integer or blank,
1: is numeric, integer, numeric or blank, integer or blank,
1.1: is numeric, strictly numeric, numeric or blank, strictly numeric or blank,
1.1: is numeric, numeric or blank,
1.1E+03: is numeric, integer, numeric or blank, integer or blank,
1.1234E+03: is numeric, numeric or blank,
: is numeric or blank, strictly numeric or blank, integer or blank, strictly integer or blank,
: is
a: is
Try it yourself: Open LIB_Function_is_numeric.b4p in B4P_Examples.zip. Decompress before use.

See also

whole
describe