释义 |
返回某字符在字符串中的个数 function StrSubCount(const Source,Sub:string):integer; //判断某字符在字符串中的个数 var Buf:string; Len,i:integer; begin Result:=0; Buf:=Source; i:=Pos(Sub, Buf); Len:=Length(Sub); while i <> 0 do begin Inc(Result); Delete(Buf,1,i+Len-1); i:=Pos(Sub,Buf); end; end; |