1
Answer

How to convert hex code to decimal and ascii code

Mann Maurya

Mann Maurya

7y
116
1
How to convert hex code to decimal and ascii code
 
eg. Hex code :- 42 56 49 
 
decima:- 66 86 73 and Ascii :- B V I 
 
please Help !! 
Answers (1)
0
Srikant Maruwada

Srikant Maruwada

NA 501 4.3k 7y
Try this code
 
private string HexString2Ascii(string hexString)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i <= hexString.Length - 2; i += 2)
{
sb.Append(Convert.ToString(Convert.ToChar(Int32.Parse(hexString.Substring(i, 2), System.Globalization.NumberStyles.HexNumber))));
}
return sb.ToString();
}