Compare

Performs a case-sensitive comparison of two strings. Returns:

  • -1 if string1 is less than string2
  • 0 if string1 is equal to string2
  • 1 if string1 is greater than string2

Returns: number

Usage

Compare( string1, string2 )

Arguments

Argument Description
string1
(string, required)

A string or a variable that contains one

string2
(string, required)

A string or a variable that contains one

Examples

dump(Compare("100 Main St.", "675 East Avenue")); // -1
dump(Compare("500 Main St.", "1 Cupertino Way")); // 1

See also