C# - Convert ASCII String To Hex
C# - Convert ASCII String To Hex
Submitted by Corey Goldberg on Fri, 29/06/2007 - 19:49.C# method to convert an ascii string to hex:
public string ConvertToHex(string asciiString)
{
string hex = "";
foreach (char c in asciiString)
{
int tmp = c;
hex += String.Format("{0:x2}",
(uint)System.Convert.ToUInt32(tmp.ToString()));
}
return hex;
}
