Investment Studio > Expressions > Functions > Text > FIND

integer find(string sub_string, string in_string, integer from_position = 1)

Looks for a case sensitive match to sub_string in in_string, starting at from_position and moving forward (to find a case insensitive match, use search 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

=find("x", "An X is not an x, nor is it a y!")

equals 16 (matches are case sensitive), while

=find("x", "An X is not an x, nor is it a y!", 17)

returns an error (#VALUE!) and

=find("x", "An X is not an x, x, x!", 17)

equals 19.

See also exact, len, mid, search.