Browse - Programming Tips - Why is String.split() not giving me empty strings?

Date: 2012may11
Language: Java

Q.  Why is String.split() not giving me empty strings?

String subject = ":"; String []a = subject.split(":");
Gives me an a.length == 0 but I expect 2. A. Regular split (helpfully) deletes trailing empty strings. So use the other form of split:
String subject = ":"; String []a = subject.split(":", -1);