X xzhxu2006 Unregistered / Unconfirmed GUEST, unregistred user! 2006-08-21 #1 我要想统计字符串中的“.”有几个; 例如:“dskfhks..asdf.asdfegg”中有几个“.”,该如何编写 请大虾帮忙!
Z zywcd Unregistered / Unconfirmed GUEST, unregistred user! 2006-08-21 #3 function my_count(tstr:string;t1:string):integer; var i:integer; p1:integer; begin if posex(t1,tstr)=0 then begin my_count:=0;exit; end; p1:=1; i:=0; repeat p1:=posex(t1,tstr,p1)+1; if p1>0 then inc(i); until p1=0; my_count:=i; end;
function my_count(tstr:string;t1:string):integer; var i:integer; p1:integer; begin if posex(t1,tstr)=0 then begin my_count:=0;exit; end; p1:=1; i:=0; repeat p1:=posex(t1,tstr,p1)+1; if p1>0 then inc(i); until p1=0; my_count:=i; end;
D dey-999 Unregistered / Unconfirmed GUEST, unregistred user! 2006-08-21 #4 length('dskfhks..asdf.asdfegg')-length(StringReplace('dskfhks..asdf.asdfegg','.','',[rfreplaceall]))
杯 杯中水 Unregistered / Unconfirmed GUEST, unregistred user! 2006-08-21 #5 dey-999佩服你的思维,我碰到这样的问题肯定是用个循环了