主要代碼如下
Function TForm
var
i
begin
i := Pos( s
j := Pos( s
slen := Length(s
if j >= i then
result := j
else
result :=
end;
procedure TForm
var
n : Integer;
begin
n := Strcount(Edit
ShowMessage(IntToStr(n));
end;
判斷字符在字符串中出現的個數
本實例是用Pos()函數來判斷字符串中是否有指定的字符
http://develop
圖
procedure TForm
var
iCount : Integer;
s
begin
iCount :=
s := Trim(Edit
s
while Pos(s
begin
inc(iCount);
Delete(s
end;
ShowMessage(IntToStr(iCount));
end;
right
From:http://tw.wingwit.com/Article/program/Delphi/201311/8462.html