Em 20/08/2010 00:47, bobby escreveu:
On 8/20/2010 5:01 AM, silvioprog wrote:
Hi bobby,
Would you show me the function?
Hi,
here it is:
function incHexStr(inHexStr: string): string;
var
HexMap: string;
i: integer;
j: integer;
s: string;
carry: integer;
begin
result := '';
s := '';
carry := 0;
HexMap := '0123456789abcdef0123456789abcdef';
for j := 1 to 16 do
if AnsiLowerCase(inHexStr[length(inHexStr)]) = HexMap[j] then
begin
if j > 15 then carry := 1;
inHexStr[length(inHexStr)] := HexMap[(j + 1)];
break;
end;
if carry = 1 then
for i := (length(inHexStr) - 1) downto 1 do
begin
if carry = 1 then
for j := 1 to 16 do
if AnsiLowerCase(inHexStr[i]) = HexMap[j] then
begin
carry := 0;
if j > 15 then carry := 1;
inHexStr[i] := HexMap[(j + 1)];
break;
end;
end;
if carry = 1 then inHexStr := '01' + inHexStr;
result := inHexStr;
end;
Thank you very much, bobby. ;)
Silvio Clécio
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus