Search for pattern in the string str and return the starting index of every such occurrence in the vector idx.
If there is no such occurrence, or if pattern is longer than
str, or if pattern itself is empty, then idx is the empty
array []
.
The optional argument "overlaps"
determines whether the pattern
can match at every position in str (true), or only for unique
occurrences of the complete pattern (false). The default is true.
If a cell array of strings cellstr is specified then idx is a cell array of vectors, as specified above.
Examples:
strfind ("abababa", "aba") ⇒ [1, 3, 5] strfind ("abababa", "aba", "overlaps", false) ⇒ [1, 5] strfind ({"abababa", "bebebe", "ab"}, "aba") ⇒ { [1,1] = 1 3 5 [1,2] = [](1x0) [1,3] = [](1x0) }
See also: findstr, strmatch, regexp, regexpi, find.
Package: octave