k = findstr('s1','s2')
k = findstr('s1','s2')
, where s1
and s2
are both character strings, finds the starting indices of any occurrences of the shorter string within the longer.
s1 = 'Find the starting indices of the shorter string.';
s2 = 'the';
findstr(s1,s2)
ans =
6 30
strcmp
(c) Copyright 1994 by The MathWorks, Inc.