int i = 0; int maxTranslationIndex = (HexString.Length);
while (i < maxTranslationIndex) { //Convert the 2 characters at the current index in the index in our input string…… string hs = System.Convert.ToChar(System.Convert.ToUInt32(HexString.Substring(i, 2), 16)).ToString(); asciiString = asciiString + hs; i += 2; }
A better Hex to Ascii conversion function.
ReplyDeleteprivate static string ConvertHextoAscii(string HexString)
{
string asciiString = "";
int i = 0;
int maxTranslationIndex = (HexString.Length);
while (i < maxTranslationIndex)
{
//Convert the 2 characters at the current index in the index in our input string……
string hs = System.Convert.ToChar(System.Convert.ToUInt32(HexString.Substring(i, 2), 16)).ToString();
asciiString = asciiString + hs;
i += 2;
}
return asciiString;
}
Is there any way to string the HexString without doing "(string HexString)" ? It won't work for me ...
ReplyDelete