Skip to main content

NUMS

Returns whether each element in a dynamic array is numeric.

Synopsis

NUMS(dynarray)

Arguments

dynarray An expression that resolves to a dynamic array.

Description

The NUMS function determines whether each element in a dynamic array is numeric or non-numeric. It returns a dynamic array of boolean values corresponding to the elements in dynarray. If an element contains a non-numeric value, NUMS returns 0 for that element. If an element contains a numeric value, NUMS returns 1 for that element. NUMS also returns 1 for the null string, or for a missing element value.

A numeric value can be a numeric or a string numeric. A valid numeric value can contain the numbers 0 through 9, plus and minus signs, and the decimal point; it cannot contain any other characters.

You can use the NUM function to determine whether a single value is numeric or non-numeric.

Examples

The following example uses the NUMS function to determine the numeric status of the elements of a dynamic array:

a=3:@VM:007:@VM:"+33.00":@VM:"":@VM:0
PRINT NUMS(a);  ! returns 1ý1ý1ý1ý1

The following example show how NUMS handles non-numeric strings, arithmetic expressions, and missing elements:

b="7dwarves":@VM:"dwarves7":@VM:@VM:(4+3):@VM:"hello world"
PRINT NUMS(b);  ! returns 0ý0ý1ý1ý0

See Also

FeedbackOpens in a new tab