This function will remove one part of a string and replace it with another.
function stuff( ToString: string;
FirstByte, NumOfBytes: integer;
FromString: string ): string;
begin
delete(toString, FirstByte, NumOfBytes);
insert(FromString, ToString, FirstByte);
stuff := ToString;
end;