- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi里面判断一个字符串在另一个字符串中出现的次数
function SubStrConut(mStr: string; mSub: string): Integer;
{ 返回子字符串出现的次数 }
begin
Result :=
(Length(mStr) - Length(StringReplace(mStr, mSub, '', [rfReplaceAll]))) div
Length(mSub);
end; { SubStrConut }
procedure TForm1.Button1Click(Sender: TObject);
begin
Caption := IntToStr(SubStrConut(Edit1.Text, Edit2.Text));
end;