I am trying to perform a split similar the following:
println \"Hello World(1)\".split(\"W\");
Output:
[Hello , orld(1)] >
The split method takes a regular expression pattern.
split
If you want to split on "just a regular string" you can use Pattern.quote to quote the string first:
Pattern.quote
println "Hello World(1)".split(Pattern.quote("("))