R
Roedy Green
I don't think this behaviour is defensible even if documented
somewhere.
Consider this:
Pattern spaceSplitter = Pattern.compile( " " );
now try it on strings with lead, embedded and trailing spaces.
lead spaces turn into "" each, but trailing spaces are ignored.
e.g.
..split( "..a.b..c.." ); (where . represents space )
gives:
""
""
"a"
"b"
""
"c"
somewhere.
Consider this:
Pattern spaceSplitter = Pattern.compile( " " );
now try it on strings with lead, embedded and trailing spaces.
lead spaces turn into "" each, but trailing spaces are ignored.
e.g.
..split( "..a.b..c.." ); (where . represents space )
gives:
""
""
"a"
"b"
""
"c"