If this is homework you need to post your attempts or thought process on this...
I think a better (but not really useful answer to your question) would be why in the heck anyone would convert a string to binary. Hex would make much more sense.
My thought process on how you COULD do this... get the ASCII value of each individual character in the string. With the ASCII value, you can easily convert the character to any base system with relative ease. Do a google search on decimal to binary code.
This is not homework and this is my attempt I don't know how to replace character with the binary code that's why I posted it on here so can someone give me some useful information on how I would go about this it would be much appreciated.