substring function

Syntax

string substring(inputString, startPos, endPos)

Parameters

Returns

Substring of inputString, extracted between indices startPos and endPos (endPos excluded).

Description

This function returns a substring of the of the inputString, starting at the index startPos and ending WITHOUT the character at index endPos (endPos excluded).

Note: The indices startPos and endPos are 0-based.

Related

Examples

substring("0123456789", 0, 5)
# result = "01234"

substring("0123456789", 2, 5)
# result = "234"

substring("0123456789", -20, 5) # startPos < 0
# result = "01234"

substring("0123456789", 0, 20)	# endPos >= len(inputString)
# result = "0123456789"

substring("0123456789", 5, 0)	# startPos >= endPos
# result = ""

Copyright ©2008-2024 Esri R&D Center Zurich. All rights reserved.