ee.Number.parse

Convert a string to a number.

UsageReturns
ee.Number.parse(input, radix)Number
ArgumentTypeDetails
inputString

The string to convert to a number.

radixInteger, default: 10

An integer representing the base number system from which to convert. If input is not an integer, radix must equal 10 or not be specified.

Examples

Code Editor (JavaScript)

print('Client-side string converted to ee.Number',
      ee.Number.parse('10'));  // 10

print('ee.String converted to ee.Number',
      ee.Number.parse(ee.String('100')));  // 100

print('Ambiguous string object converted to ee.Number',
      ee.Number.parse(ee.Feature(null, {id: '1000'}).get('id')));  // 1000

print('Ambiguous number object converted to ee.Number',
      ee.Number.parse(ee.Feature(null, {id: 1000}).get('id')));  // 1000

print('Leading zeros are removed',
      ee.Number.parse('0001'));  // 1