2011-11-10 37 views
0

如果您有一個屬性,其值由逗號分隔的值列表組成,這將是檢索該值的一部分的最佳方法?Unboundid LDAP SDK - 如何處理由多個值組成的屬性值?

例子:

myAttribute:值1,值2,值3,值4

到目前爲止,我用正則表達式來做到這一點,但是這似乎不知何故錯誤(因爲我覺得那裏可能是更好的解決方案)。

我使用Unboundid LDAP SDK來訪問LDAP。

回答

3

LDAP屬性值的部分無法檢索。該屬性具有值,並且該值將返回給LDAP客戶端。也許你myAttribute應該是多值:

dn: cn=the entry,dc=example,dc=com 
myAttribute: value1 
myAttribute: value2 
myAttribute: value3 
myAttribute: value4 

如果這個不適合你的應用程序,然後StringTokenizerjava.util.regex將工作拆分值。