title: java - newline detection in strings
body: <p>I know that similar questions have been asked several times, but the answers I saw are either workarounds or simply incorrect.</p>
  
  <p>The basic problem is fairly simple: A method gives me a string read from a file and I need to check if this string contains newline.</p>
  
  <p>Now to the tricky part: <a href="http://en.wikipedia.org/wiki/Newline" rel="nofollow">Wikipedia</a> currently lists eight types of characters or character combinations which may, dependent on the system, denote a newline. So checking for the common <code>\n</code> and <code>\r</code>, an answer, that I often read, is not the way to go. Walking through the string and compare its characters with <code>System.getProperty("line.separator")</code> might also fail, since a possible newline representation is `\r\n', that will trigger this comparison twice, though its only one newline.</p>
  
  <p>However, this has to be possible. What option am I missing?</p>