title: Query about the trim() method in Java
body: <p>I asked a question earlier but met harsh criticism, so here I pose it again. Simpler, and rephrased to appeal to those who may have been concerned about the way I asked it before.</p>
  
  <p>BACKGROUND
  I am parsing some HTML for information. I have isolated everything in a series of lines but the content I wish to grab and a bunch of spaces after it. To get rid of the spaces, I opted to use trim(), but I have been having trouble. The last few lines of my code are tests:</p>
  
  <pre><code>System.out.println("'" + someString + "'\n'" + someString.trim() + "'");
  </code></pre>
  
  <p>The results were:</p>
  
  <pre><code>'Sophomore                                          '
  'Sophomore                                          '
  </code></pre>
  
  <p>I was worried I might have a problem with the way I was calling trim(), since we all make mistakes from time to time, so I tested it like this:</p>
  
  <pre><code>String s = "   hello         ";
  System.out.println("'" + s+ "'\n'" + s.trim() + "'");
  </code></pre>
  
  <p>The results were:</p>
  
  <pre><code>'  hello     '
  'hello'
  </code></pre>
  
  <p>MY QUESTION
  What am I doing wrong? What I want is to get 'Sophomore', not 'Sophomore                                          '</p>
  
  <p>I look forward to your excellent answers (thanks in advance!).</p>