hexstr

tbytes 转 十六进制 string

孤人 提交于 2019-12-05 18:34:05
function Bytes2HexStr(buf: TBytes; len: Integer): AnsiString; begin SetLength(Result, len* 2 ); BinToHex(@buf[ 0 ], PAnsiChar(Result), len); end ; procedure TForm1.FormCreate(Sender: TObject); var bf: TBytes; Str: AnsiString; begin bf := BytesOf( '5677899090jjnm,nAB0098CDEFG' ); rStr := Bytes2HexStr(bf, Length(bf)); ShowMessage(rStr); end ; 来源: oschina 链接: https://my.oschina.net/u/582827/blog/596506