Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hexadecimal to string and vice versa
Message
From
05/06/2006 17:12:48
 
 
To
05/06/2006 12:57:06
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01126987
Message ID:
01127213
Views:
10
>I'm not sure if it would give different results but I would use:

The implementation I did using your approach solved the issue. As per the other message, I adjusted to this:
        ' Convert from hexadecimal to string
        ' expC1 String in hexadecimal
        Public Function HexadecimalToString(ByVal tcString As String) As String
            Dim lnCounter As Integer = 0
            Dim loAscii As Encoding = Encoding.ASCII
            Dim loBytes((tcString.Length / 2) - 1) As Byte
            For lnCounter = 0 To (tcString.Length / 2) - 1
                loBytes(lnCounter) = [Byte].Parse(tcString.Substring(lnCounter * 2, 2), _
                 Globalization.NumberStyles.HexNumber)
            Next
            Return loAscii.GetString(loBytes)
        End Function
The Dim declaration with the -1 makes it ok with the exact match on the round trip.

Thanks
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Reply
Map
View

Click here to load this message in the networking platform