findstr

Purpose

Find one string within another.

Synopsis

k = findstr('s1','s2')

Description

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.

Examples

s1 = 'Find the starting indices of the shorter string.';
s2 = 'the';
findstr(s1,s2)
          
ans =
     6    30

See Also

strcmp

(c) Copyright 1994 by The MathWorks, Inc.