Split string of binary values and convert it to hex

I have a string of binary values "10001110011110101110", what is the best way to convert it to hex value "8e7ae"?

I can split string into 5 parts using substring (e.g.)

hex1 =message.substring(0,4);

But how to convert string value 1000 to hex 8?

Hello,

You can use function strtoul

Works good. Thank you.