function CountOccurences( const SubText: string; const Text: string): Integer;
begin
if (SubText = '') OR (Text = '') OR (Pos(SubText, Text) = 0) then
Result := 0
else
Result := (Length(Text) - Length(StringReplace(Text, SubText, '', [rfReplaceAll]))) div Length(subtext);
end;
Delphi 计算一个字符串在另一个字符串中出现的次数
最新推荐文章于 2023-06-04 15:11:58 发布