ee.String.equals

  • The String.equals() method checks if a string is lexicographically equal to a given object.

  • It returns true if the target is a string and matches the reference string, and false otherwise.

  • The method is used with a target object to compare against the reference string.

Checks for string equality with a given object. Returns true if the target is a string and is lexicographically equal to the reference, or false otherwise.
Usage Returns
String. equals (target) Boolean
Argument Type Details
this: reference
String The string to compare for equality.
target
Object The second object to check for equality.

Examples

Code Editor (JavaScript)

 var 
  
 sp 
  
 = 
  
 ee 
 . 
 String 
 ( 
 'Abies grandis' 
 ); 
 print 
 ( 
 '"Abies grandis" equals "Abies grandis"?' 
 , 
  
 sp 
 . 
 equals 
 ( 
 'Abies grandis' 
 )); 
 print 
 ( 
 '"Abies grandis" equals "abies grandis"?' 
 , 
  
 sp 
 . 
 equals 
 ( 
 'abies grandis' 
 )); 
 print 
 ( 
 '"Abies grandis" equals "Thuja plicata"?' 
 , 
  
 sp 
 . 
 equals 
 ( 
 'Thuja plicata' 
 )); 

Python setup

See the Python Environment page for information on the Python API and using geemap for interactive development.

 import 
  
 ee 
 import 
  
 geemap.core 
  
 as 
  
 geemap 

Colab (Python)

 sp 
 = 
 ee 
 . 
 String 
 ( 
 'Abies grandis' 
 ) 
 display 
 ( 
 '"Abies grandis" equals "Abies grandis"?' 
 , 
 sp 
 . 
 equals 
 ( 
 'Abies grandis' 
 )) 
 display 
 ( 
 '"Abies grandis" equals "abies grandis"?' 
 , 
 sp 
 . 
 equals 
 ( 
 'abies grandis' 
 )) 
 display 
 ( 
 '"Abies grandis" equals "Thuja plicata"?' 
 , 
 sp 
 . 
 equals 
 ( 
 'Thuja plicata' 
 )) 
Design a Mobile Site
View Site in Mobile | Classic
Share by: