Investment Studio > Expressions > Functions > Text > SEARCH
integer search(string sub_string, string in_string, integer from_position = 1)
Looks for a case insensitive match to sub_string in in_string, starting at from_position and moving forward (to find a case sensitive match, use find instead).
If sub_string is found, its start position in in_string is returned. Otherwise, the result is an error (#VALUE!).
If sub_string is "" (empty text), the first character in the search string is matched, causing from_position to be returned.
The first position in a string is 1, so from_position must be >= 1. If from_position is omitted, it defaults to 1.
Examples
=search("x", "An X is not an x, nor is it a y!")
equals 4 (matches are case insensitive), while
=search("x", "An X is not an x, nor is it a y!", 17)
returns an error (#VALUE!) and
=search("x", "An X is not an x, x, x!", 17)
equals 19.