DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C# (http://www.daniweb.com/forums/forum61.html)
-   -   hexadecimal convertions (http://www.daniweb.com/forums/thread83711.html)

quintoncoert Jul 17th, 2007 5:11 am
hexadecimal convertions
 
hi. can anyone tell me if there is any build-in functions which converts hexadecimal to decimal and decimal to hexadecimal in C#?

Hamrick Jul 17th, 2007 9:44 am
Re: hexadecimal convertions
 
System.String.Format lets you do that with the D and X formatters.
string decString = string.Format( "{0:D}", decValue );
string hexString = string.Format( "{0:X}", hexValue );
You can also just print the formatted values with Write or WriteLine because they use the same formatter strings.


All times are GMT -4. The time now is 7:41 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC