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

Bo Berglund bo.berglund at gmail.com
Fri Jul 28 14:54:30 CEST 2017


On Tue, 25 Jul 2017 10:54:30 +0200, Bo Berglund
<bo.berglund at gmail.com> wrote:

>so I need to write efficient
>replacements for certain string functions (Delete, Insert, Copy etc).

What I am now up aginst after a few days work is to find how to code
the Pos() function for strings...
The comm buffer apparently contains the 2-char string as indication of
the last and the existing code uses Pos() to find it.

What about something like:
function PosBytes(SearchItem, Target: TBytes): integer;
begin
  ?????
end;

What could I use inside the body of this function to mimik the string
function Pos (for AnsiStrings)?


-- 
Bo Berglund
Developer in Sweden




More information about the fpc-pascal mailing list