longqcc

学习永远止境,更要学会总结。本博客大多数的内容都是从网上收集而来,加上自已的一点整理。在这里特别感谢“万一”老师的分享,谢谢!

博客园 首页 新随笔 联系 管理
function GetSubStrNum(const SubStr,Str: WideString): Integer; var   pw: PWideChar;   i,SubLen: Integer; begin   Result := 0;   pw := PWideChar(Str);   SubLen := Length(SubStr);   while i > 0 do   begin     i := Pos(SubStr, pw);     Inc(pw, i - 1 + SubLen);     if Boolean(i) then Inc(Result);   end; end; 

 
function GetSubStrNum(const SubStr, Str: widestring ): Integer; var   i,x: Integer;   Len,LenSubStr: Integer; begin   Result := 0;   i := 1;   LenSubStr := Length(SubStr);   Len := Length(Str) - LenSubStr + 1;   while i <= Len do   begin     if Str[i] = SubStr[1] then     begin       x := 1;       while (x < LenSubStr) and (Str[i+x] = SubStr[x+1]) do Inc(x);       if (x = LenSubStr) then Result := Result + 1;       Inc(i,x);     end else Inc(i);   end; end; 

 菊子曰:我在用着的博客编辑软件
posted on 2013-05-18 04:26  longqcc  阅读(365)  评论(0编辑  收藏  举报