Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ReplaceEx(Text, FindStr, ReplaceStr: string; Offset: Integer): string;
- var
- fsL, tL: Integer;
- begin
- fsL := Length(FindStr);
- tL := Length(Text);
- if ((fsL > tL) or (Offset > tL)) then
- Exit;
- if (Offset < 1) then
- Offset := 1;
- Result := (Copy(Text, 1, (Offset - 1)) + Replace(Copy(Text, Offset, ((tL - Offset) + 1)), FindStr, ReplaceStr, [rfReplaceAll]));
- end;
- var
- str: string;
- begin
- str := 'Janilabo is naab';
- WriteLn(ReplaceEx(str, 'a', 'o', (Pos('abo ', str) + 1)));
- end.
Advertisement
Add Comment
Please, Sign In to add comment