求!!!将16进制字符转化为其补码的C#代码,求高人解答
答案:1 悬赏:0 手机版
解决时间 2021-12-02 07:26
- 提问者网友:轮囘Li巡影
- 2021-12-01 11:15
求!!!将16进制字符转化为其补码的C#代码,求高人解答
最佳答案
- 五星知识达人网友:一叶十三刺
- 2021-12-01 12:52
string hexString =“8E2”;
string n="";
if(hexString >0)
{
int num = Int32.Parse(hexString , System.Globalization.NumberStyles.HexNumber);
n = Convert.ToString(num, 2);
}
else
{
int num = ~Int16.Parse(hexString , System.Globalization.NumberStyles.HexNumber)+1;
string n = Convert.ToString(num, 2);
n=n.Substring(16, 16);
}
Console.WriteLine(n);
string n="";
if(hexString >0)
{
int num = Int32.Parse(hexString , System.Globalization.NumberStyles.HexNumber);
n = Convert.ToString(num, 2);
}
else
{
int num = ~Int16.Parse(hexString , System.Globalization.NumberStyles.HexNumber)+1;
string n = Convert.ToString(num, 2);
n=n.Substring(16, 16);
}
Console.WriteLine(n);
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯