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