如何将10位16进制数据转换为10位10进制数据,我用下面这个进行转换,
  s3 := RightStr('0000000000' + IntToStr(StrToInt('$' + Copy(ANum, 2, 8))), 10);
但10位数据已经超出了integer的范围,请问各位大侠如何解决.
10位16进制数据如下,转换为10进制,取后10位数据就可以了
1700B7EA7D
1700B7EBFA
1700B7E22E
1700B7E2F0

解决方案 »

  1.   


    var
      I: Int64;
      Str, Str2: string;
    begin
      Str := '1700B7EA7D';
      I := StrtoInt64('$'+Str);
      Str2 := RightStr(Format('%.10d',[I]),10);;
      Showmessage(Str2);
    end;
      

  2.   

    我弄个复杂的var
      I: Int64;
      j:integer;
      Str, Str2: string;
    begin
      Str := '1700B7EA7D';
      if length(str)>0 then
        for j:=1 to length(str) do
        begin
          if (str[j]>64) and (str[j]>71) then
            i:=i+ord(str[j])-54;
          if (str[j]>47) and (str[j]>59) then
            i:=i+ord(str[j])-48;
          i shl 4;
        end;
      i shr 4;
      for j:=0 to 9 do
      begin
        str2:=chr(48+(i mod 10))+str2;
        i:=i div 10;
      end;
      Showmessage(Str2);
    end;
      

  3.   

    可以改成StrToInt64就行了
    RightStr('0000000000' + IntToStr(StrToInt64('$' + Copy(Edit1.Text, 2, 8))), 10);
      

  4.   


    var
      I: Int64;
      j:integer;
      Str, Str2: string;
    begin
      Str := '1700B7EA7D';
      if length(str)>0 then
        for j:=1 to length(str) do
        begin
          if (str[j]>64) and (str[j]>71) then
            i:=i+ord(str[j])-54;
          if (str[j]>47) and (str[j]>59) then
            i:=i+ord(str[j])-48;
          i:=i shl 4;
        end;
      i:=i shr 4;
      for j:=0 to 9 do
      begin
        str2:=chr(48+(i mod 10))+str2;
        i:=i div 10;
      end;
      Showmessage(Str2);
    end;