Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Count2(s, str: string): Integer;
- var
- p: Integer;
- begin
- if (Length(s) <= Length(str)) then
- repeat
- p := PosEx(s, str, (p + 1));
- if (p > 0) then
- Inc(Result);
- until (p <= 0);
- end;
- var
- s, str: string;
- begin
- ClearDebug;
- str := '|||| Count2() Test ||| *** ||| Smooth. ||||';
- s := '||';
- WriteLn('Count of "' + s + '" in string: ' + IntToStr(Count2(s, str)) + '!');
- end.
Advertisement
Add Comment
Please, Sign In to add comment