instr Function
|
Function: |
Finds the Nth occurrence (defined by num, counting from 1) of a substring substr in a string sourcestr. Search is conducted from position frompos (leftmost character has position 1). |
|
Syntax: |
instr(frompos as byte,byref sourcestr as string, byref substr as string, num as byte) as byte |
|
See Also: |
--- |
|
Part |
Description |
|
frompos |
Position in the sourcestr from which to start searching. Leftmost character has position 1. |
|
sourcestr |
Source string in which the substring is to be found. |
|
substr |
Substring to search for within the source string. |
|
num |
Occurrence number of the substr, counting from 1. |
Details
This function returns the position in a string or zero if the Nth occurrence of the substring is not found.
Examples
x = instr(3,"ABCABCDEABC12","BC",2) ' result will be 10