substring function

string substring(inputString, startPos, endPos)

inputString string

startPos float

endPos float

Returns a substring of the inputString, extracted between indices startPos and endPos (endPos excluded).

This function returns a substring 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 = ""