Calculation Formulas
Back to Calculation Formulas Overview
Back to Functions Overview
Function "IndexOf"
IndexOf(text, searchfortext [, startindex])
Function: Searches for an occurrence of the text "searchfortext" in the given "text". Returns the zero-based index of the first occurrence of "searchtext" or "-1" if none was found. Optionally, a zero-based "startindex" can be specified with the effect that the search in "text" will not start at the beginning of "text" but at the character position specified by "startindex".
Return-Type: Number
Arguments:
text - Type Text: The text string to search in.
searchfortext - Type Text: The string to search for.
The third argument is optional:
startindex - Type Number: The character position at which the search will be started. If
not given, the search will always start at the first character (index "0").
Examples:
IndexOf("a longer text", "lo")
IndexOf("abc def abc def", "abc", 4)