Instr

Strings
Aptilis 1

Instr([FromWhere,] String1, String2)

Instr looks for a string into another string. It returns the position of the searched string if it has been found, otherwise it returns zero.
When Aptilis is dealing with strings, indexes start at 1. For example, the index of "tw" in "two" is 1, and the index of "wo" in "two" is 2.
The optional index specified before the two strings allows you to search from a given position. That is especially useful when you try to find several occurences of the same substring in one given string.

Return Value:
The index of the substring being searched or 0 (zero) if it has not been found.

Example 1:

e = "can of beans" $
print(instr(e$, "of"))
Result:
5.0000

Example 2:

e = "can of beans of Canada" $
print(instr(7, e$, "of"))
Result:
14.0000

Notes:
Even if a start position is given, the index returned will be a count from the first character.

See also:
Rinstr