Ich habe die Proc einfach mal neu geschrieben, und ich denke mal, die tut jetzt, was Du willst. Die ist aber weder auf Speed noch auf Schönheit optimiert, sollte aber logisch nachzuvollziehen sein
Dieses Array [011110000111100101111010] würde dann 'xyz' ergeben
Delphi-Quellcode:
function Boolarrtostr(BA: Tboolarr): string;
var
TempByte: Byte;
ArrayPos, Count8Bits, MaxBits: Integer;
begin
Result := '';
if Length(BA) = 0 then
Exit;
MaxBits := High(BA);
TempByte := 0;
Count8Bits := 0;
ArrayPos := Low(BA);
while ArrayPos <= MaxBits do
begin
TempByte := TempByte shl 1;
if BA[ArrayPos] then
TempByte := TempByte or 1;
Inc(Count8Bits);
if Count8Bits = 8 then
begin
Result := Result + Chr(TempByte);
TempByte := 0;
Count8Bits := 0;
end;
Inc(ArrayPos);
end;
if Count8Bits > 0 then
Result := Result + Chr(TempByte);
end;
...
...