4
Is there any function equivalent to bin2hex()
from PHP to C#?
I need to convert a hexadecimal to binary. I tried to use the TryParse
but it hasn’t worked out.
4
Is there any function equivalent to bin2hex()
from PHP to C#?
I need to convert a hexadecimal to binary. I tried to use the TryParse
but it hasn’t worked out.
5
Yes, the type conversion functions allow you to use the base you need:
Convert.ToString(Convert.ToInt32("4F56A", 16), 2)
Behold working in the ideone. And in the .NET Fiddle. Also put on the Github for future reference.
Documentation Convert.ToString()
and Convert.ToInt32()
.
Browser other questions tagged c# .net string hexadecimal
You are not signed in. Login or sign up in order to post.
It worked perfectly, thank you!
– João K. Queiroz