Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hexadecimal to string and vice versa
Message
De
05/06/2006 17:12:48
 
 
À
05/06/2006 12:57:06
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01126987
Message ID:
01127213
Vues:
16
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform