Function: text.substring

Extracts the substring between two zero-based indexes of a source string.

A negative index is considered an offset from the end of the string. If an index is outside of the source string's range, it is clamped to the bounds of the range.

For example, text.substring("hello", -10, 10) returns "hello", and text.substring("hello", 2, 4) returns "ll".

Arguments

Arguments
source

string

The string whose substring will be returned.

start

int

The start index (inclusive) of the substring. Index is zero-based.

end

int

The end index (exclusive) of the substring. Index is zero-based.

Returns

The substring.

Raised exceptions

Exceptions
TypeError If source is not a string; or, if either start or end is not an integer.