I have been doing a lot of research on Diffie-Hellman, and I understand how Alice and Bob are able to get a shared g^ab using both of their private keys. However, I am unsure about how this can be applied to passwords (strings). I assume you have to do something with the hex version of both the password and g^ab, but what? Any help would be much appreciated!
No, DH does not apply to strings. However, what you are likely trying to achieve is to perform Diffie-Hellman with authentication. For that you can use a PAKE protocol, which stands for Password Authenticated Key Exchange (Wikipedia obviously made a bit of a mess of the naming, Password-Authenticated Key Agreement would be PAKA, not PAKE).
In such protocols DH is performed and the password authentication is part of the protocol; if the password is not correct then either the protocol exits early or the shared secret is not computed to the correct value, which means that subsequent authentication will fail.
Strings are a special case of numbers. Everything computer algorithms operate on are just special cases of numbers. The string "abc" is commonly encoded as 0x616263, but that's just a number (6,382,179). A movie stored in an AVI file can be thought of as just one massive number, with potentially billions of digits. Numbers can be very large. That's not a problem. So there's no algorithmic problem with
b being a number that happens to represent any string you like.
But you should never use Diffie-Hellman this way.
The first part of the confusion in your question is that Diffie-Hellman typically operates on random numbers. And human-selected passwords are not random in any useful way. So if you try to plug passwords into DH, you're on the wrong track.
The second part of the confusion is that the whole point of a key agreement protocol like DH is typically to agree on a ephemeral key, a key that will only be used for a short time and then thrown away. If you have some long-lived shared secret like a password, you typically wouldn't need a key agreement protocol. So DH is the wrong tool.