..:: MX Studio Fóruns ::..: Codificação e decodificação Hex para string - ..:: MX Studio Fóruns ::..

Jump to content

Publicidade




Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Codificação e decodificação Hex para string

#1 User is online   xanburzum 

  • Group: Administrador
  • Posts: 2073
  • Joined: 04-November 08

Posted 04 October 2011 - 02:23 PM

Codificação e decodificação Hex string

function hexEncoder(str)
        dim strEncoded, i
        strEncoded = ""
        for i = 1 to Len(str)
                strEncoded = strEncoded + "%" + Hex(Asc(Mid(str, i, 1)))
        next
        hexEncoder = strEncoded
end function

function hexDecoder(str)
        dim strDecoded, i, hexValue
        strDecoded = ""
        for i = 2 to Len(str)
                hexValue = ""
                while Mid(str, i, 1) <> "%" and i <= Len(str)
                        hexValue = hexValue + Mid(str, i, 1)
                        i = i+1
                wend
                strDecoded = strDecoded + chr(CLng("&h" & hexValue))
        next
        hexDecoder = strDecoded
end function

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic



Publicidade




1 User(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)