substring

substring

> Functions

Returns the substring of the string string starting from the character at index start and of size length.

Parameters
Return
Python

In Python, you take a slice: s[start:end] returns the characters from index start included to end excluded, hence s[start:start + length] for a length length. Both bounds are optional (s[3:], s[:5]), a negative index counts from the end (s[-3:]), and a third number sets the step: "Hello world!"[2:10:2] is "lowr".

Examples

substring("Hello world!", 3) // "lo world!" substring("Hello world!", 3, 6) // "lo wor"

See as well