delphi IntToHexAnsi


本文整理自网络,侵删。

 
function IntToHexAnsi(N : Integer; Digits: Byte) : AnsiString;
var
    Buf : array [0..7] of Byte;
    V : Cardinal;
    I : Integer;
begin
    V := Cardinal(N);
    I := Length(Buf);
    if Digits > I then Digits := I;
    repeat
        Dec(I);
        Buf[I] := V mod 16;
        if Buf[I] < 10 then
            Inc(Buf[I], $30)
        else
            Inc(Buf[I], $37);
        V := V div 16;
    until V = 0;
    while Digits > Length(Buf) - I do begin
       Dec(I);
       Buf[I] := $30;
    end;
    SetLength(Result, Length(Buf) - I);
    Move(Buf[I], Pointer(Result)^, Length(Buf) - I);
end;

相关阅读 >>

Delphi html转义字符编码转换

Delphi 时间与字符串

Delphi+mysql:tadoquery使用插入中文乱码解决方法

Delphi 热键声明和使用

Delphi 2009 之 tstringbuilder 类[1]: create

Delphi 生成txt 指定带bom

winapi 字符及字符串函数(3): charupper - 字符或字符串转大写

Delphi 内存补丁

Delphi listview1 图标不齐,错乱解决方法

Delphi 用空格把 s 凑够 n 的长度

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



打赏

取消

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

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

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

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

评论

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