geetools.String#

Extra methods for the ee.String class.

Package Contents#

Classes#

StringAccessor

Toolbox for the ee.String class.

class geetools.String.StringAccessor(obj)[source]#

Toolbox for the ee.String class.

Initialize the String class.

Parameters:

obj (ee.String) –

eq(other)[source]#

Compare two strings and return a ee.Number.

Parameters:

other (geetools.types.ee_str) – The string to compare with.

Returns:

1 if the strings are equal, 0 otherwise.

Return type:

ee.Number

Examples

import ee, geetools

ee.Initialize()

s = ee.String("foo").geetools.eq("foo")
s.getInfo()
format(template)[source]#

Format a string with a dictionary.

Replace the keys in the string using the values provided in the dictionary. Follow the same pattern: value format as Python string.format method.

Parameters:

template (geetools.types.ee_dict) – A dictionary with the values to replace.

Returns:

The formatted string.

Return type:

ee.String

Examples

import ee, geetools

ee.Initialize()

s = ee.String("{greeting} {name} !").geetools.format({"greeting": "Hello", "name": "bob"})
s.getInfo()