String relational(comparison) operators

You use the relational (comparison) operators =, <>, ><, <, <=, =<, >, >=, and => to ascertain the relative positions of two strings in ASCII sort order. The result of comparing two strings in this way is a value of True, False, or NULL (if one of the operands is NULL). Whether the comparison is case sensitive or case insensitive depends on the setting of the Option Compare statement in the module in which the comparison takes place. Option Compare Case (the default) makes string comparison case sensitive; Option Compare NoCase makes string comparison case insensitive.

You can also make string comparison case sensitive with Option Compare Binary. This specifies that string comparison is case sensitive, and the sort order is determined by the platform and character set on which your product is running LotusScript®.

For Asian (double-byte) characters, whether the comparison is pitch sensitive or pitch insensitive depends on the setting of the Option Compare statement in the module in which the comparison takes place. Option Compare Pitch (the default) makes string comparison pitch sensitive; Option Compare NoPitch makes string comparison pitch insensitive.

This example illustrates using of relational operators to perform string comparison. The user enters a character, which is then checked to see if it falls in the range A-Z. If not, the character is checked to see if it falls in the range a-z.

Option Compare Binary
Dim theChar As String
theChar$ = InputBox$("Please enter a character:")
If ((theChar$ >= "A") And (theChar$ <= "Z")) Then
   Print "You entered an uppercase character."
ElseIf ((theChar$ >= "a") And (theChar$ <= "z")) Then
   Print "You entered a lowercase character."
Else
   Print "You entered a nonalphabetic character."
End If