110,536
社区成员
发帖
与我相关
我的任务
分享
string[] hex = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F" };
string input = "81C519DE36FE0CCA";
long output = 0;
string temp = "";
for (int i = 0; i <= input.Length - 1; i++)
{
temp = input[i].ToString();
for (int n = 0; n <= hex.Length - 1; n++)
{
if (temp == hex[n])
{
output += (long)((Math.Pow(16, input.Length - 1 - i)) * n);
break;
}
}
}
Console.WriteLine(output);