MATLAB Function Reference    
strfind

Find one string within another

Syntax

Description

k = strfind(str,pattern) searches the string, str, for occurrences of a shorter string, pattern, returning the starting index of each such occurrence in the double array, k. If pattern is not found in str, or if pattern is longer than str, then strfind returns the empty array, [].

The search performed by strfind is case sensitive. Any leading and trailing blanks in either str or pattern are explicitly included in the comparison.

Use the function findstr, if you are not certain which of the two input strings is the longer one.

Examples

See Also

findstr, strmatch, strtok, strcmp, strncmp, strcmpi, strncmpi, regexp, regexpi, regexprep


  streamtube strings