Skip to content

strfind

builtin · libnexusinterp/corefcn/strfind-proprietary.cc

: idx = strfind (str, pattern)

Report every position in str at which pattern begins.

The result idx is a row vector of one-based starting indices, and it counts overlapping matches. It is empty when pattern does not occur or when pattern is the empty string.

When str is a cell array of strings the search runs over each element and idx is a cell array of the matching index vectors. pattern may also be a cell array: paired with a cell str it must hold the same number of elements and is matched element by element, whereas paired with a single str it searches that one string for each pattern in turn.