ee.String.compareTo

Compares two strings lexicographically. Returns: the value 0 if the two strings are lexicographically equal; a value less than 0 if string1 is less than string2; and a value greater than 0 if string1 is lexicographically greater than string2.

UsageReturns
String.compareTo(string2)Integer
ArgumentTypeDetails
this: string1String

The string to compare.

string2String

The string to be compared.

Examples

JavaScript

print(ee.String('a').compareTo('b'));  // -1
print(ee.String('a').compareTo('a'));  // 0
print(ee.String('b').compareTo('a'));  // 1

print(ee.String('a').compareTo(ee.String('b')));  // -1

Python

# Your example goes here!