一.strfind函数
函数用法说明: strfind(s1,s2)--or strfind(s1,pattern)
说明:在s1中搜索pattern
例子:
相关解答:
function r=myfun2
rand('seed',2301)
c=97+fix(14*rand(1,32000));
c=char(c);
a=strfind(c,'dfe')
r=a
二.findstr函数
findstr(s1,s2)--在较长的字符串中查找较短的字符串出现的次数,并返回其位置。
说明:无论s1,s2哪个为长字符串,位置在前在后都没有关系。
例子:
function r=myfun2
rand('seed',2301)
c=97+fix(14*rand(1,32000));
c=char(c);
a=findstr(c,'dfe')
r=a