The
index
function returns the first location from the left (starting with 0), in whichpattern
appears in the input string. It returns -1 when the pattern is not found.
● stm_—The standard prefix of Statemate functions.
● index—Signifies that the function looks for a location in the string.
● string—The input string in which the pattern is searched.
● offset—An integer greater than or equal to zero that represents the location at which the search begins.
● pattern—The string to search for.
● status—The return status code. The possible values arestm_success
orstm_null_string
(when uninitialized strings are used as parameters).stm_index(’ABCA’,0,’C’,status) = 2
stm_index(’ABCA’,0,’AB’,status) = 0
stm_index(’ABCA’,2,’A’,status) = 3
stm_index(’ABCA’,0,’AC’,status) = -1