| MATLAB Function Reference | Search  Help Desk |
| findstr | Examples See Also |
Find one string within another
Syntax
k = findstr(str1,str2)
Description
k = findstr(str1,str2)
finds the starting indices of any occurrences of the shorter string within the longer.
Examples
str1 = 'Find the starting indices of the shorter string.';
str2 = 'the';
findstr(str1,str2)
ans =
6 30
See Also
strcmp, strmatch, strncmp