And just to be safe, why are you looking for the positions of the commas? Depending on what you are trying to do with that info there may be a better way to do it avaoiding this step.
What I really needs I have user credentials in a older system in jdoe,dept,comp and I need it in fully distiguisded to manipulate using ldap like
cn=jdoe,ou=dept,o=comp.