title: split string by char
body: <p>scala has a standard way of splitting a string in <code>StringOps.split</code></p>
  
  <p>it's behaviour somewhat surprised me though.</p>
  
  <p>To demonstrate, using the quick convenience function</p>
  
  <pre><code>def sp(str: String) = str.split('.').toList
  </code></pre>
  
  <p>the following expressions all evaluate to true</p>
  
  <pre><code>(sp("") == List("")) //expected
  (sp(".") == List()) //I would have expected List("", "")
  (sp("a.b") == List("a", "b")) //expected
  (sp(".b") == List("", "b")) //expected
  (sp("a.") == List("a")) //I would have expected List("a", "")
  (sp("..") == List()) // I would have expected List("", "", "")
  (sp(".a.") == List("", "a")) // I would have expected List("", "a", "")
  </code></pre>
  
  <p>so I expected that split would return an array with (the number a separator occurrences) + 1 elements, but that's clearly not the case.</p>
  
  <p>It is almost the above, but remove all trailing empty strings, but that's not true for splitting the empty string.</p>
  
  <p>I'm failing to identify the pattern here. What rules does StringOps.split follow?</p>
  
  <p>For bonus points, is there a good way (without too much copying/string appending) to get the split I'm expecting?</p>