Skip to main content

Text.get

getindexif_missing

Aliases: get character

Documentation

Returns a character from the text at the specified index (0-based). If the index is invalid then if_missing is returned.

Arguments

  • index: The location in the text to get the character from. The index is also allowed be negative, then the characters are counted from the end of the text, i.e. -1 will correspond to the last character. - if_missing: The value to return if the index is out of bounds.

Examples

Get the individual characters in the text "건반(Korean)".

      "건반(Korean)".get 1 == "반"

Remarks

What is a Character?

A character is defined as an Extended Grapheme Cluster, see Unicode Standard Annex 29. This is the smallest unit that still has semantic meaning in most text-processing applications.