本文整理自网络,侵删。
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+mysql:tadoquery使用插入中文乱码解决方法
Delphi 2009 之 tstringbuilder 类[1]: create
winapi 字符及字符串函数(3): charupper - 字符或字符串转大写
更多相关阅读请进入《Delphi》频道 >>