# ee.String.equals

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.

<br />

| 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)

```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](https://developers.google.com/earth-engine/guides/python_install) page for information on the Python API and using
`geemap` for interactive development.

```python
import ee
import geemap.core as geemap
```

### Colab (Python)

```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'))
```