Posts Tagged ‘String to hex

28
Mar
09

[VB.Net] String to Hex Conversion

Migrating old code snippits over to the new blog.

Function StringToHex(ByVal text As String) As String
    Dim hex As String
    For i As Integer = 0 To text.Length - 1
        hex &= Asc(text.Substring(i, 1)).ToString("x").ToUpper
    Next
    Return hex
End Function

Usage:

Debug.WriteLine(StringToHex("sim0n"))

Would Output:
73696D306E

Advertisements