I would like to replace a buffer handling scheme in an old application (written in Delphi) where the buffer was originally of type string and later when unicode appeared changed to AnsiString.
But AnsiString also causes potential headaches so I would like to get rid of it altogether by using a TBytes container instead. The problem is that the code utilizes heavily a few string oriented functions like: To remove Count processed bytes from the beginning: Buffer: AnsiString; Delete(Buffer, 1, Count) or worse: Buffer := Copy(Buffer, Count+1, Length(Buffer)); For adding new data (c: AnsiChar) to the end: Buffer := Buffer + c; I would like to instead use TBytes as container but then I would not like to rewrite all of the code so I would like to be able to do something like: Buf: TBytes; b: byte; Delete(Buf, Index, Count); //Removes Count bytes at Index BufAdd(Buf, b); //Extends size of Buf and puts b last Is it possible to overload Delete() so it can be called with TBytes as argument? For adding data the + operator would have been fine but I have no idea how one could do that... -- Bo Berglund Developer in Sweden _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal