Convert Binary Code String to Hexadecimal

Possible duplicate:
Convert long string of binary code to hexadecimal C #

nyI'm is looking for a way to convert a binary string to a sixth string.

the binary string has four positions. the binary string looks something like this:

string binarystring= "1011";

      

the output line should look something like this:

output string="B";

      

Is there a way to convert a binary string to hex?

+3


source to share


1 answer


Convert.ToInt32("1011", 2).ToString("X");

      

For more information on string value used ToString()

as a parameter, check the following documentation:



https://msdn.microsoft.com/en-us/library/dwhawy9k(v=vs.110).aspx

+13


source







All Articles