title: How to convert Attributes to String?
body: <p>I want to convert <code>Attribute</code>s to <code>String</code> so that I can trim and get a substring of the attribute value.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>Attribute attrs = match.getAttributes();
  
  NamingEnumeration e = attrs.getAll();
  System.out.println(attrs.get("cn"));
  System.out.print(attrs.get("uniqueMember"));
  
  unique_members[i] = attrs.get("uniqueMember");
  </code></pre>
  
  <p>I am facing an error in the last line where I want to store the value of <code>uniqueMember</code> to the <code>unique_members</code> array. Error: </p>
  
  <blockquote>
    <p>Type mismatch: cannot convert from Attribute to String</p>
  </blockquote>
  
  <p>I have tried the following so far:</p>
  
  <pre><code>unique_members[i] = (String)attrs.get("uniqueMember");
  </code></pre>
  
  <p>It doesn't solve the issue and I am getting error:</p>
  
  <blockquote>
    <p>Cannot cast attribute to String.</p>
  </blockquote>