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.)

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.