Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Text value to HEX
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Divers
Thread ID:
01056827
Message ID:
01056858
Vues:
16
Alan,
Here is some code
string myString = "abcd";

System.Text.ASCIIEncoding ascii = new System.Text.ASCIIEncoding();
      
byte[] ba = ascii.GetBytes(myString);

string myString0 = "";
string myString1 = "";
for (int i = 0 ; i < ba.Length ; i++)
{
	myString0 += ba[i].ToString("X2") + " ";
	myString1 += "0x"+ba[i].ToString("X2")+" ";
}
MessageBox.Show(myString0 + Environment.NewLine +myString1);
Hope this is kinda what you were looking for or atleast put you on the right track.

Please let me know if I misunderstood.

Einar

>I want to build a string of characters, similar to a UPC code. Then convert those characters into a string of equivilant Hexa-decimal bytes (in test) each seperated by a space. I need it this way to pass it to some RFID hardware.
>
>Is there a pre-built class in C# that can convert the ASCII character to a HEX string? If not, does anyone have a way to accomplish this?
>
>thanks
>
>Alan Wyne
Semper ubi sub ubi.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform