Extract Range

Extracts a given range of characters from the input text

The Range parameter is given as two numbers in the form from:to (note the colon between the values). The first character in the input text has the index zero. As an example, 0:3 would extract the first 3 characters.

Negative values can be used to “anchor” the selection at the end of the input (e.g. to extract the last x characters, regardless of how long the text is).

One of the values can be left empty to extend the selection to the start/end of the input (the colon still has to be included though).

The following examples use the input text “Hello World”:

  • 0:3 – “Hel”
  • :3 – Same as above (if the from component is zero, it can be left out)
  • 3: – “lo World” (everything except for the first three characters)
  • -5: – “World” (note that the from component is a negative number, so the characters are counted from the end; the to component is left out, so the range extends to the end of the text)

Input/Output:

  • Input: The text to extract the range from
  • Output: The characters in the given range

Parameters

  • Range (from:to): The range to extract, see above for examples

See Also