Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function StrPosAllTCA(TCA: TCharArray; str: string): TIntArray;
- var
- h, h2, i, i2, i3, d, o, p, r: Integer;
- begin
- h := High(TCA);
- if ((h < 0) or (str = '')) then
- Exit;
- if (h >= 1) then
- for i := (h - d) downto 1 do
- for i2 := (i - 1) downto 0 do
- if (TCA[i] = TCA[i2]) then
- begin
- h2 := High(TCA);
- for i3 := i to (h2 - 1) do
- TCA[i3] := TCA[(i3 + 1)];
- SetLength(TCA, h2);
- Inc(d);
- Break;
- end;
- h := High(TCA);
- SetLength(Result, Length(str));
- for i := 0 to h do
- begin
- repeat
- p := PosEx(TCA[i], str, (o + 1));
- if (p > 0) then
- begin
- Result[r] := p;
- o := p;
- Inc(r);
- end;
- until (p <= 0);
- o := 0;
- end;
- SetLength(Result, r);
- SortTIA(Result);
- end;
- var
- TIA: TIntArray;
- begin
- TIA := StrPosAllTCA(['I', 'l'], 'Janilabo is a nub. JANILABO = NOOB! loIIol');
- WriteLn(TIAToStr(TIA));
- SetLength(TIA, 0);
- end.
Advertisement
Add Comment
Please, Sign In to add comment