title: Get the index of the start of a newline in a Stringbuffer
body: <p>I need to get the starting position of new line when looping through a StringBuffer.
  Say I have the following document in a stringbuffer</p>
  
  <pre><code>"This is a test
  Test
  Testing Testing"
  </code></pre>
  
  <p>New lines exist after "test", "Test" and "Testing".</p>
  
  <p>I need something like:</p>
  
  <pre><code>for(int i =0;i &lt; StringBuffer.capacity(); i++){
  if(StringBuffer.chatAt(i) == '\n')
      System.out.println("New line at " + i);
  
  }
  </code></pre>
  
  <p>I know that won't work because '\n' isn't a character. Any ideas? :)</p>
  
  <p>Thanks</p>