Mann Maurya

Mann Maurya

  • NA
  • 104
  • 8.8k

Convert Hex To Ascii

Jun 7 2019 1:30 AM
MessageId0=000;
MessageId1=099;
 
hexString = "008" + MessageId0 + MessageId1 + "000003000000000" + MessageId0 + MessageId1 + "001";
 
private string HexString2Ascii(string hexString)
{
   StringBuilder sb = new StringBuilder();
   for (int i = 0; i <= hexString.Length - 3; i += 3)
   {
      sb.Append(Convert.ToString(Convert.ToChar(Int32.Parse(hexString.Substring(i, 3),       System.Globalization.NumberStyles.Number))));
   }
   Label1.Text = sb.ToString();
   return sb.ToString();
}
 
this code is workin fine till MessageId1=127; after 127 (like 128,141;) is just converting all the number to  63 (b).
 
i want conversion should be proper till 256 
 
please help  !
thanks in advance !!  
 
 
 
 

Answers (1)