ChengjunWu / google-refine

Automatically exported from code.google.com/p/google-refine
Other
0 stars 0 forks source link

Split eats empty pieces #550

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
"/".split("/") returns one piece instead of two and "/user/foo" returns just 
two, making it impossible to reliably extract the namespace (without using a 
trick like (" "+"/user/foo").split("/") ) which works as expected.

Split should return N+1 pieces when given a string with N separators 
independent of whether the separator is a leading or trailing character.

Original issue reported on code.google.com by tfmorris on 14 Mar 2012 at 11:34

GoogleCodeExporter commented 8 years ago
Grrr, this is apparently how it's documented to work.  I'm not thrilled about 
the default (I think it should return all pieces by default), but it's probably 
too late to change it now.

Original comment by tfmorris on 15 Mar 2012 at 5:50