Development tools : Global functions : String category : compare
  
compare
Description
Compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings. If a string is null or empty, it is considered to be lexicographically before other string with value.
Usage
Client side: Y
Server side: Y
Syntax
Integer compare(String string1, String string2)
Argument
string1
The string to be compared. The argument can be any string.
string2
The string to compare. The argument can be any string.
Return
0 if string1 is the same as string2.
1 if string1 is after string2.
-1 if string1 is before strings in dictionary order.
Example
compare("Hello", "World") returns -1
Go up to
String category