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 为数字补充前缀0

Delphi makeuniquefilename 创建文件名如果已经存在自动更改文件名

Delphi tstringlist 排序 customsort

firemonkey 手机 app 的手势

Delphi xe7组件tetheringmanager1发送消息

Delphi基于sobel算子的图像边缘检测

Delphi winapi: gettopwindow - 获取指定窗口的子窗口中最顶层的窗口句柄

Delphi 收藏字符串处理单元

Delphi 在长文件名和短文件名之间转换

Delphi 闪盘小偷

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



打赏

取消

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

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

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

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

评论

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