A distinguished name (DN) uniquely identifies an entry in the directory tree. You can get the DN for an entry (see "Getting Distinguished Names from the Results") or specify a DN to read an entry from the directory (see "Reading an Entry").
The Netscape Directory SDK for Java contains a utility class, LDAPDN, that provides methods for manipulating DNs.
Getting the Components of a Distinguished Name
If you want to access individual components of a distinguished name or a relative distinguished name, invoke the LDAPDN.explodeDN method or the LDAPDN.explodeRDN method.
Both functions return an array of strings representing the individual components of the distinguished name.
You can specify whether or not you want the names of the components included in the array by using the notypes parameter.
LDAPDN.explodeDN( "uid=bjensen, ou=People, o=Airius.com", false )
{ "uid=bjensen", "ou=People", "o=Airius.com" }
Set notypes to true if you don't want to include the component names in the array.
LDAPDN.explodeDN( "uid=bjensen, ou=People, o=Airius.com", true )
{ "bjensen", "People", "Airius.com" }