Skip to content

NMV

Numeric Value

This numeric function determines if the given string contains a valid numeric value.

NMV (string-value)
string-value
is a valid string.

This function is generally available starting with release level 8.1.

This function returns the numeric value 1 for null strings and for strings that contain a valid numeric value (i.e., strings that can be converted to a numeric value by the NUM function).

This function returns the numeric value 0 for strings that do not contain a valid numeric value.

Starting with release 8.2.2, this function will properly evaluate strings that contain numeric values where periods and commas were reversed by the SET CMASK directive.

NMV("1234")

returns the numeric value 1 since 1234 is a numeric value.

NMV(A$)

If A$=12.34 then the numeric value returned is 1.

LET X = NMV(C$)

If C$=.24E+5 then X is assigned the value 1.

LET X = NMV(B$)

If B$=$12.34 then X is assigned the value 0 since $ is not a legal numeric character.

NMV ("12 34")

returns the value 1.

NMV("ABCD")

returns the value 0 since letters are not numeric characters.

SET CMASK ".=," ;
N$=STR(12345.67),
X=NMV(N$)

X will be assigned the value 1 because N$ contains the value 12345,67 and , (comma) is a legal numeric character when periods and commas have been reversed.

SET CMASK ".=," ;
N$=STR(12345.67:"###,###.00"),
X=NMV(N$)

X will be assigned the value 0 because N$ contains the value 12.345,67 and . (period) is not a legal numeric character when periods and commas have been reversed.

NUM function

From the Thoroughbred Basic Language Reference, Volume II: F–Q, version 8.9.1. Open this page in the PDF