Text.index_of
index_oftermstart case_sensitivity
Group: Values
Documentation
Find the first 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 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!".index_of "J" == Nothing
"Hello World!".index_of "o" == 4
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.