本文整理自网络,侵删。
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;
相关阅读 >>
Delphi使用cef4Delphi制作chromium谷歌内核浏览器
winapi 字符及字符串函数(9): lstrcat - 合并字符串
更多相关阅读请进入《Delphi》频道 >>