Skip to main content

SCMP

Performs a string comparison of two numbers.

Synopsis

SCMP(num1,num2)

Arguments

num1 An expression that resolves to a number or a numeric string.
num2 An expression that resolves to a number or a numeric string.

Description

The SCMP function compares two numeric values, expressed as either numbers or as strings. Leading plus signs and leading and trailing zeros are ignored. A string is parsed as a number until a non-numeric character is encountered. Thus “7dwarves” is parsed as 7. Non-numeric strings and the null string are parsed as 0.

The comparison return values are as follows:

  • -1: num1 < num2

  • 0: num1 = num2

  • 1: num1 > num2

See Also

FeedbackOpens in a new tab