Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program New;
- function InsertBetweenMix(str, insB, insA, frm, unt: string): string;
- var
- fI, uI: Integer;
- begin
- repeat
- fI := PosEx(frm, str, uI + 1);
- uI := PosEx(unt, str, fI + 1);
- if fI <= 0 then
- Break;
- if uI <= 0 then
- uI := Length(str);
- Insert(insB, str, fI);
- IncEx(uI, Length(insB) + 1);
- Insert(insA, str, uI);
- IncEx(uI, Length(insA));
- until false;
- Result := str;
- end;
- begin
- Writeln(InsertBetweenMix('Hello {world}, how are you {the world}?', '[', ']', '{', '}'));
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement