Files
highground-fork/string/docs/modify/substring.md

718 B

string_Substring

Get a substring of a string.

Arguments

  • str (string): the string to get a substring of.
  • start (int): starting index of the substring.
  • end (int): ending index of the substring.

Returns

substring (string): the substring of the given string.

Raises

  • AllocFail: raised if Ground failed to allocate memory for the new string.
  • EndBeforeStart: raised if the end index is less than the start index.
  • OutOfBounds: raised if either the end or start index is outside the bounds of the string.

Example

Ground

call !string_Substring "Hello, World!" 1 3 &sub
println $sub # "ell"

Solstice

puts string_Substring("Hello, World!", 1, 3) // "ell"