Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi byte array to string (https://www.delphipraxis.net/46202-byte-array-string.html)

mumu 20. Mai 2005 14:43


byte array to string
 
wie konvertiere ich ein byte array in einen string?

gibt es dafür vielleicht ne funktion in der jedi library?

gruß

barf00s 20. Mai 2005 14:44

Re: byte array to string
 
Delphi-Quellcode:
SetLength(deinString, SizeOf(deinByteArray));
Move(Pointer(deinString)^, Pointer(deinByteArray)^, SizeOf(deinByteArray));

Luckie 20. Mai 2005 14:45

Re: byte array to string
 
Ein Byte ist im Endeffekt auch nur ein Integer und den kann man mit Delphi-Referenz durchsuchenIntToStr in einen String konvertieren.

Waldteufel 20. Mai 2005 15:05

Re: byte array to string
 
Hi.

@Luckie: Ich glaube eher, er meint sowas hier:

Delphi-Quellcode:
type
  TByteArray = array of byte;

function TuWas(array1 : TByteArray) : string
var
  i : integer;
begin
  result := '';
  for i := Low(array1) to High(array1) do
    result := result + chr(array1[i]);
end;

Delphiscn 20. Mai 2005 15:23

Re: byte array to string
 
Great :-D

mumu 20. Mai 2005 21:36

Re: byte array to string
 
oki!

vielen dank!


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:27 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz