怎样能把十进制转换成为二进制、八进制、十六进制,它们之间互相转换怎样实现?需要什么函数?
比如:我想把十六进制转换成为十进制有什么函数???

解决方案 »

  1.   

    The following example uses an edit control, a button, and a label on a form. When the button is clicked, the hexadecimal value of each character in the edit control is displayed in the label.procedure TForm1.Button1Click(Sender: TObject);var
      i: Integer;
    begin
      Label1.Caption := '';
      for i := 1 to Length(Edit1.Text) do
      begin
        try
          Label1.Caption := Label1.Caption + IntToHex(Edit1.Text[i],2) + ' ';
        except
          Beep;
        end;
      end;
    end;
      

  2.   

    Converts a string of hexadecimal digits to the corresponding binary value.UnitClassesCategorytype conversion routinesDelphi syntax:function HexToBin(Text, Buffer: PChar; BufSize: Integer): IntegerC++ syntax:extern PACKAGE int __fastcall HexToBin(char *Text, char *Buffer, int BufSize);DescriptionCall HexToBin to convert the hexadecimal string Text to the binary value it represents.Text is a string representation of a hexadecimal value.Buffer returns the resulting value in binary.BufSize is the size of Buffer. Text needs to point to at least 2*BufSize hexadecimal characters, because each two hexadecimal characters represent one byte.HexToBin returns the number of characters in Buffer that have not been used because Text did not contain valid hexadecimal characters ('0'..'f').Note: The hexadecimal number must use lower-case characters; HexToBind does not recognize upper-case characters.