Visual Basic, C & C++
분류 Delphi

델파이에서 16진수 문자열을 2진수 문자열로 바꾸기

페이지 정보

본문

function HexToBin(sHex: string): string;
var
  iHex, iDigit : integer;
begin
  iDigit := Length(sHex) * 4;
  iHex := StrToInt('$' + sHex);

  result := StringOfChar('0', iDigit);
  while iHex > 0 do begin
    if (iHex and 1) = 1 then
      result[iDigit] := '1';
    dec(iDigit) ;
    iHex := iHex shr 1;
  end;
end;

관련자료

등록된 댓글이 없습니다.
프로그래밍
Today's proverb
행복은 우리 마음속에 숨어 있는 거예요. 우리가 마음의 문을 열고 긍정적인 생각만 가진다면 우리에게 선물로 주어지는 거예요. 《어린 왕자에게서 배우는 삶을 사랑하는 지혜》, 최현복