ee.String.index

Searches a string for the first occurrence of a substring. Returns the index of the first match, or -1.
UsageReturns
String.index(pattern)Integer
ArgumentTypeDetails
this: targetStringThe string to search.
patternStringThe string to find.

Examples

Code Editor (JavaScript)

print(ee.String('abc123').index(''));  // 0
print(ee.String('abc123').index('c1'));  // 2
print(ee.String('abc123').index('ZZ'));  // -1