28
Mar
09

[VB.Net] Hex to String Conversion

Function HexToString(ByVal hex As String) As String
    Dim text As New System.Text.StringBuilder(hex.Length \ 2)
    For i As Integer = 0 To hex.Length - 2 Step 2
        text.Append(Chr(Convert.ToByte(hex.Substring(i, 2), 16)))
    Next
    Return text.ToString
End Function

Usage:

Debug.WriteLine(HexToString("73696D306E"))

Would output:
sim0n



2 Responses to “[VB.Net] Hex to String Conversion”


  1. May 11, 2009 at 10:18 pm

    Thanks a lot for the code! And for the String to Hex too :D :D


Leave a Reply