Equinox Online Help - Language Reference - A to Z

Home

IsNumber

Applies to
SyntaxIsNumber (StringExpression)
Action[Function] Identifies whether a given string is (or contains) a numeric value.
ScopeUsable anywhere.
Notes

This function examines the argument (StringExpression) and returns one of the values:

  • -1 StringExpression contains an entirely numeric value.
  • 0 StringExpression is not a numeric value.
  • >0 The first (leftmost) part of StringExpression is numeric. The value returned indicates how many leading characters are numeric.

Note the following points:

  • Any leading spaces are included in the returned value.
  • Exponential (scientific) number formats are recognised. eg The string "3E2" is recognised as the numeric value 3*102 and the value -1 is returned.
  • The function does not perform any conversions. Conversions take place automatically, when required.
CategoryString handling
See Also ChrList, Chrs, Compare, Fill, Left_Function, Len, Match, Maxlen, Mid_Function, Remove, Replace, Right_Function], Search_SearchNext, SetLen, SetMaxLen, SortOrder, SubstituteData
Example

The following example shows how the function may be used to separate a string value into numeric and non-numeric parts.

string s
number n, x

s = "123abc"                       | initial String value
n = s                                     | automatic conversion: n = 123
x = IsNumber(s)                 | x = 3: size of numeric part of s
Left(s, IsNumber(s)) = ""  | s = "abc"
s = "123abc"
s = Left(s, IsNumber(s))    | s = "123"