■ 16진수 문자열 → 2진수 문자열 구하기

----------------------------------------------------------------------------------------------------

Public Function GetBinaryCode(ByVal strHexadecimalCode As String) As String

 

    Dim nHexadecimalStringLength As Integer

    Dim nTemporaryNumber         As Integer

    Dim strResult                As String

    Dim I                        As Integer

    Dim J                        As Integer

    

    nHexadecimalCodeLength = Len(strHexadecimalCode)

    

    For I = 1 To nHexadecimalCodeLength

 

        nTemporaryNumber = CInt("&H" & Mid(strHexadecimalCode, I, 1))

 

        For J = 3 To 0 Step -1

 

            If nTemporaryNumber >= 2 ^ J Then

 

                strResult = strResult & "1"

 

                nTemporaryNumber = nTemporaryNumber - 2 ^ J

 

            Else

 

                strResult = strResult & "0"

 

            End If

 

        Next J

 

    Next I

 

    GetBinaryCode = strResult

 

End Function

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요