FANDOM


Slicing is basically getting a substring from a string. It is similar to indexing, except that it usually contains multiple characters. Like most other operations a functions, it is zero-indexed.

ExamplesEdit

"Hello World!"[4:9]
returns
o Worl

If the first argument is omitted, the slicing starts at the start of the string. If the last argument is omitted, the slicing ends at the end of the string.

"Hello World!"[:9]
returns
Hello Worl
"Hello World!"[4:]
returns
o World!
"Hello World!"[:]
returns
Hello World!
(The string itself.)