var
s:string;
m,t:integer;
begin
s:=quotedstr('avx中')+','+quotedstr('avx2中')+','+quotedstr('avx3中');
// showmessage(s);
m:=1 ;
t:=1;
// showmessage(inttostr(posex(',',s,1)));
// t:=posex(',',s,1);
// showmessage(midbstr(s,t+2,posex(',',s,9)-t-3))
while posex(',',s,m)>0 do
begin
//showmessage('m:='+inttostr(m));
if t=1 then
showmessage(midbstr(s,t+1,posex(',',s,m)-m-2))
else
showmessage(midbstr(s,t+2,posex(',',s,m)-m-2));
t:=posex(',',s,m);
// showmessage(midbstr(s,t+2,posex(',',s,t)-t-3));
m:=t+1;
showmessage('m:='+inttostr(m));
end;
showmessage(midbstr(s,m+1,length(s)-m-1));
本文展示了一段使用Pascal语言进行字符串处理的代码片段,包括如何利用Pascal内置函数处理字符串,例如查找子串位置、截取子串等。通过对这段代码的解析,读者可以了解Pascal中字符串处理的基本方法。

被折叠的 条评论
为什么被折叠?



