| MATLAB Function Reference | Search  Help Desk |
| findstr | Examples See Also |
Find one string within another
k = findstr(str1,str2)
k = findstr(str1,str2)
finds the starting indices of any occurrences of the shorter string within the longer.
str1 = 'Find the starting indices of the shorter string.';
str2 = 'the';
findstr(str1,str2)
ans =
6 30
strcmp Compare strings
strmatch Find possible matches for a string
strncmp Compare the first n characters of two strings