<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Comments on snippet: 'Convert a Number to an hexadecimal String'</title>
<link>http://snipplr.com</link>
<description>Snipplr comments feed'</description>
<language>en-us</language>
<pubDate>Sat, 25 May 2013 09:01:23 GMT</pubDate>
<item>
<title>topinnovation said on 4/26/10</title>
<link>http://snipplr.com/view/22921/convert-a-number-to-an-hexadecimal-string/</link>
<description><![CDATA[ Number system conversion using C#.NET
Decimal to Hexadecimal
Input: 
Range		Min:0, Max:18446744073709551615 or (2^64 - 1).
Datatype	UInt64
Processing	input.ToString(“X”);
Output:
Datatype	string
Range		Min:0h, Max:FFFFFFFFFFFFFFFFh.

Hexadecimal to Decimal
Input: 
Range		Min:0h, Max:FFFFFFFFFFFFFFFFh.
Datatype	string
Processing	UInt64.Parse(input, System.Globalization.NumberStyles.HexNumber).ToString();
Output:
Range		Min:0, Max:18446744073709551615 or (2^64 - 1).
Datatype	string

Decimal to Binary
Input: 
Range		 Min:0, Max:18446744073709551615 or (2^64 - 1).
Datatype	UInt64
Processing
...
string binaryStr = String.Empty;
while (input > 0)
{
  binaryStr += (input % 2).ToString();
  input /= 2;
}
// Arrange the humanreadable format MSB on leftmost end and LSB on righmost end.
binaryStr = ReverseString(binaryStr);
return binaryStr;
...
private static string ReverseString(string str)
{
  char[] charArray = str.ToCharArray();
  Array.Reverse(charArray);
  return new string(charArray);
}
Output:
Range		0 – 64 bit
Datatype	string

Binary to Decimal
Input: 
Range		0 to 64 bit
Datatype	string
Processing	Convert.ToUInt64(input, 2).ToString(); 
Output:
Range		Min:0, Max:18446744073709551615 or (2^64 - 1).
Datatype	string

Hexadecimal to Binary
Processing
1.	Hexadecimal to Decimal
2.	Decimal to Binary

Binary to Hexadecimal
Processing
1.	Binary to Decimal
2.	Decimal to Hexadecimal ]]></description>
<pubDate>Mon, 26 Apr 2010 06:28:50 GMT</pubDate>
<guid>http://snipplr.com/view/22921/convert-a-number-to-an-hexadecimal-string/</guid>
</item>
</channel>
</rss>