How does Diffie-Hellman apply to strings? 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.