Sfairadora

  • Reference Guide

find_str

find_str(str, substr)
find_str(str, pos, substr)
Finds the first occurrence of the string substr in the string str and returns its index. If the parameter pos is specified, the string is searched from that index.
The function returns the index of the first occurrence of the string being searched. The index of the first character in the string is 0. If pos is negative, its value is considered 0. If the string is not found, an error is returned. This condition can be handled, for instance, using the try statement. If pos is beyond the end of the string str, the function always fails (returns an error).
Note: this function serves to search a character string. To serach binary data, use the analogical function find_bytes.

Parameters

str
The string in which to search. Type String or Text.
substr
The string to be searched for. Type String or Text.
pos
Position where begin searching. Type Int. The value 0 denotes the beginning of the string.

Return Value

The function returns the index of the first occurrence found (the Int type) or an error.

See Also