Since String.split() works with regular expressions, this snippet:
String s = \"str?str?argh\";
s.split(\"r?\");
... yields: <
Using directly the Pattern class, is possible to define the expression as LITERAL, and in that case, the expression will be evaluated as is (not regex expression).
Pattern.compile(, Pattern.LITERAL).split();
example:
String[] result = Pattern.compile("r?", Pattern.LITERAL).split("str?str?argh");
will result:
[st, st, argh]