[fpc-pascal] Best way to insert bytes into a TBytes variable?

Bo Berglund bo.berglund at gmail.com
Sun Jul 30 08:06:28 CEST 2017


On Fri, 28 Jul 2017 16:35:05 +0200, Michael Schnell
<mschnell at lumino.de> wrote:

>On 25.07.2017 10:54, Bo Berglund wrote:
>>   so I need to write efficient replacements for certain string functions (Delete, Insert, Copy etc).
>Why do you think the string function (if using strictly just a single 
>UTF-8 or RawByte branded String type) are not efficient ?
>
>If all string encoding brands in an operation are the same there will be 
>no conversion.

Sorry,
I was not clear in my question...

What I meant to say is that I need to convert an existing application
that uses strings (AnsiString) as binary data buffers to instead use
TBytes buffers. Thus my quest is for functions operating like the
convenient string functions but on TBytes arrays.

All of this is because I have found that using AnsiString is
triggering data changes when the application is running in certain
countries (locales) and processing certain data values...

The application was started back in Delphi7 times when "string"
actually meant AnsiString and was a 1-byte per element container.

By efficient I meant that I probably would write inefficient code if I
had to create things like the mentioned functions myself and if the
compiler did the job it would be more efficient.


-- 
Bo Berglund
Developer in Sweden




More information about the fpc-pascal mailing list