Input in hex or ASCII, but ensure output in ASCII?
I am trying reading in data from XML files using C# XMLTextReader. Most of the data I am reading in comes in as ASCII, however there are a few values that come in as hex.
To read the data I am using the following line of code:
string PIDData = reader.ReadElementString();
Console.WriteLine("Value: " + PIDData);
So when PIDData is in hex the output 开发者_如何学运维is in hex.
How can I perform a test to see if the value is hex or ASCII and perform the conversion if it is hex?
If you have a string that contains the value...
BEEF
...would you classify this as ASCII or hex?
You can't - it could be either.
精彩评论