Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Text value to HEX
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Miscellaneous
Thread ID:
01056827
Message ID:
01056858
Views:
15
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform