使用pos函数来查找字符第一次出现的位置 pos(要查找的字符串,在字符串中查找)
var
str1:string;
i,j:integer;
begin
str1:='dsf4654f6<ds>ad' ;
j:=pos('<',str1);//在字符串str1中查找"<"
if j<>0 then //得到的j是字符串中出现的位置,是整型
showmessage('<'+'在第'+inttostr(j)+'个位置');
end;
本文来自博客园,作者:del88,转载请注明原文链接:https://www.cnblogs.com/del88/archive/2011/11/06/2238017.html