ldap - split function to change order -
i used methode treepath [dc=example,dc=com,ou=usres] , need make ou=usres,dc=example,dc=com tried methode change order
public static string changestring(string old) { old = old.replace('[', ' '); old = old.replace(']', ' '); old.trim(); string array[] = old.split(","); string result = ""; (int = 1; <= array.length; i++) { if(i != 1) result +=","+ array[array.length-i]; else result += array[array.length-i]; }
but ou=usres,dc=com,dc=example how can change position of ou=users
if using java, suggest use unboundid sdk. using dn class, can break down items public rdn[] getrdns(), returns rdn[]
then reorder rdn[] , create new dn dn(rdn... rdns).