Delphi StreamToHexStr


本文整理自网络,侵删。

 
function StreamToHexStr(AStream: TStream): String;
const
  HexChars: array[0..15] of Char = '0123456789ABCDEF';
var
  i,len: Integer;
begin
  len := AStream.Size - AStream.Position;
  SetLength(Result, len * 2);
  AStream.Read(Pointer(Result)^, len);
  for i := len downto 1 do begin
    Result[i * 2]    := HexChars[Byte(Result[i]) and $0F];
    Result[i * 2 -1] := HexChars[(Byte(Result[i]) and $F0) shr 4]
  end;
end;

相关阅读 >>

Delphi dcc32.exe 参数说明

webbrowser点击没有id和name的按钮或链接

Delphi 主线程等待子线程的安全退出

Delphi开发linux的动态库

Delphi中获取memo鼠标所在位置的行和列

Delphi 如何将图片转换成文本

Delphi目录操作示例

Delphi 字符串定界符

Delphi逐个读取access中的数据

Delphi 进制转换之10进制与34进制互转

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...