title: split method of String class does not include trailing empty strings
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/545957/java-split-method-strips-empty-strings-at-the-end">Java split() method strips empty strings at the end?</a>  </p>
  </blockquote>
  
  
  
  <p>The split method of String class does not include trailing empty strings in the array it returns. How do I get past this restriction:</p>
  
  <pre><code>class TestRegex{
   public static void main(String...args){
    String s = "a:b:c:";    
    String [] pieces = s.split(":");
  
    System.out.println(pieces.length); // prints 3...I want 4.
   }
  }
  </code></pre>