Converting string value to hex decimal

前端 未结 5 2188
渐次进展
渐次进展 2020-12-16 06:59

i am making application in c#. In that implication i have string which contain decimal value as

string number=\"12000\"; 

The Hex equivale

5条回答
  •  别那么骄傲
    2020-12-16 07:30

    If you want to convert it to hex string you can do it by

    string hex = (int.Parse(number)).ToString("X");
    

    If you want to put only the number as hex. Its not possible. Becasue computer always keeps number in binary format so When you execute int i = 1000 it stores 1000 as binary in i. If you put hex it'll be binary too. So there is no point.

提交回复
热议问题