converting decimal into hexadecimal
-
hi, is there any simple way or code that i can use to convert a decimal into a hexadecimal? Thanks in advance:)
I dont think there is any inbuilt function for these you need to do it manually :rolleyes:
Paras Kaneriya
The difference between genius and stupidity is that genius has its limits. -
hi, is there any simple way or code that i can use to convert a decimal into a hexadecimal? Thanks in advance:)
-
hi, is there any simple way or code that i can use to convert a decimal into a hexadecimal? Thanks in advance:)
There is no direct conversion. First parse the decimal string into a numeric value. Example:
string dec = "123"; int num = int.Parse(dec);
Then format the number into a string in hexadecimal format. Example:string hex = num.ToString("x");
You can specify the number of digits you want in the hexadecimal number:string hex = num.ToString("x4");
--- single minded; short sighted; long gone;
-
hi, is there any simple way or code that i can use to convert a decimal into a hexadecimal? Thanks in advance:)
int value = 15; string hex = string.Format("{0:x2}", value); Console.WriteLine(hex); Console.ReadKey();
Deja View - the feeling that you've seen this post before.