gusucode.com > 《精通matlab 7》包括配套光盘 > 配套光盘里的程序附件/Ex-07/Ex0707.m

    %例7-7 字符串的查找
a='Welcome to MATLAB!';
b='Welcome,Sir!';
c='Welcome';
ab=strcat(a,b)
strfind(ab,c)	%strfind中长字符串在前,否则返回空数组
strfind(c,ab)
findstr(ab,c)	%findstr中两个字符串位置可变
findstr(c,ab)
strmatch(a,c)	%strmatch中长字符串应在后
strmatch(c,a)
strmatch(c,a,'exact')
[wel1,rem1]=strtok(ab,'!')
[wel2,rem2]=strtok(rem1,'!')