Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {==============================================================================]
- Explanation: Returns str stuffed with s.
- iFrom=start position, iCount=count of chars to stuff with.
- [==============================================================================}
- function Stuff(str, s: string; iFrom, iCount: Integer): string;
- var
- l: Integer;
- begin
- Result := string(str);
- l := Length(Result);
- if (iFrom < 1) then
- iFrom := 1;
- if (iFrom > l) then
- iFrom := l;
- if (iCount > 0) then
- begin
- if (iCount < 1) then
- iCount := 1;
- if (iCount > l) then
- iCount := l;
- Delete(Result, iFrom, iCount);
- end;
- Insert(s, Result, iFrom);
- end;
- var
- str: string;
- begin
- ClearDebug;
- str := 'Stuff test to see this is working..!';
- WriteLn(Stuff(str, '() WORKS', 6, 30));
- end.
Advertisement
Add Comment
Please, Sign In to add comment