How to separate names
I have to search LDAP to get email address. However, all I have to work with is a name, such as Joe Smith. I can plug that in and it will find it.
However, sometimes nothing will be returned because the name in LDAP will be Joe X. Smith, and I only have Joe Smith to work with.
How can I break up the name Joe Smith into a first name of Joe and lastname of Smith ? I think I can then use the first name and lastname variables to search, thus bypassing any names with a middle initial. Also, it if is reversed and I have Joe X. Smith to work with, how can I still break up into first and last names without the middle initial. I just want a first and lastname to work with, so I can use that to search LDAP.
If this is not the proper way, what would be the best way to get email addresses from LDAP.
Thanks for any help.
