Skip to main content

StrCompare function (LotusScript Language)

Compares two strings and returns the result.

Syntax

StrCompare ( string1 , string2 [ , compMethod ] )

StrComp is acceptable in place of StrCompare.

Elements

string1

Any String expression.

string2

Any String expression.

compMethod

A number designating the comparison method.

NumberComparison method
0Case Sensitive, Pitch sensitive
1Case Insensitive, Pitch sensitive
4Case Sensitive, Pitch insensitive
5Case Insensitive, Pitch insensitive

Use 2 to specify string comparison in the platform's collation sequence. If 2 is specified, strings are compared bit-wise. If you omit compMethod, the default comparison mode is the mode set by the Option Compare statement for this module. If there is no statement for the module, the default is case-sensitive and pitch-sensitive.

Return value

The following table shows what StrCompare returns, depending on the relationship between the strings being compared.

Strings being comparedStrCompare result
Either string is NULLNULL
string1 is less than string2-1
string1 equals string20
string1 is greater than string21

Example