Converter Valores Decimal Para Hexadecimal

Delphi

16/11/2004

existe algum códgio tipo strtoint ou inttostr para converte um valor de decimal para hexadecimal e vice-versa.


Tap_pedroso

Tap_pedroso

Curtidas 0

Respostas

Massuda

Massuda

16/11/2004

var
  N: Integer = 33; 
  S: string;
begin
  // gera uma string em formato decimal
  S := IntToStr(N);  // S = ´33´

  // gera uma string em formato hexadecimal
  // IntToHex está em SysUtils
  S := IntToHex(N, 2);  // S = ´21´

  // converte formato decimal para inteiro
  S := ´33´;
  N := StrToInt(S);  // N = 33

  // converte formato hexadecimal para inteiro
  S := ´$21´;  // note o cifrão
  N := StrToInt(S);  // N = 33



GOSTEI 0
POSTAR