Skip to main content

Text.substring

substringstartlength

Group: Selections
Aliases: mid, slice, substring

Documentation

Creates a new Text by selecting the specified range of the input.

Arguments

  • start: the character position to start the substring at. 0-based index. Has support for negative values.
  • length: the number of characters to include from start.

Returns

Part of the selected Text starting at start and stopping after length.

Examples

Various different ways to take part of "Hello World!"

      "Hello World!".substring 3 2 == "lo"
"Hello World!".substring 5 Nothing == " World!"
"Hello World!".substring 5 7 == " World!"
"Hello World!".substring -7 3 == " Wo"