ee.String.trim

Returns a string whose value is the original string, with any leading and trailing whitespace removed.

UsageReturns
String.trim()String
ArgumentTypeDetails
this: stringStringThe string to trim.

Examples

Code Editor (JavaScript)

var s = ee.String('\t\n\r abc\t\n\r ');
print(s.trim());  // "abc"

var s = ee.String(' a\t\n\r b ');
print(s.trim());  // "a\t\n\r b"

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)

s = ee.String('\t\n\r abc\t\n\r ')
print(s.trim().getInfo())  # "abc"

s = ee.String(' a\t\n\r b ')
print(s.trim().getInfo())  # "a\t\n\r b"