/// <summary>
/// //16转2方法
/// </summary>
/// <param name="hexString"></param>
/// <returns></returns>
static string HexString2BinString(string hexString)
{
try
{
string result = string.Empty;
foreach (char c in hexString)
{
int v = Convert.ToInt32(c.ToString(), 16);
int v2 = int.Parse(Convert.ToString(v, 2));
// 去掉格式串中的空格,即可去掉每个4位二进制数之间的空格,
result += string.Format("{0:d4} ", v2);
}
return result.Replace(" ","");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
throw;
}
}
标签:Convert,转换,进制,16,int,hexString,result,string From: https://blog.51cto.com/u_16371710/9238054