Skip to main content

Text.last_index_of

last_index_oftermstartcase_sensitivity

Group: Values

Documentation

Find the last index of the term in the input. Returns Nothing if the term was not found in the input. Using locate is preferred as then you can also get the length of the match which may not necessarily be equal to the length of the searched term - not only in case of regex matching but also in case insensitive mode. See the Match Length section of locate for an explanation.

Arguments

  • term: The term to find.
  • start: The index to start searching backwards from. If the index is negative, it is counted from the end of the vector.
  • case_sensitivity: Specifies if the text values should be compared case sensitively.

Examples

Finding location of a substring.

      "Hello World!".last_index_of "J" == Nothing
"Hello World!".last_index_of "o" == 7

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.