I'm trying to split a String and retain n + 1 items where there are n delimiters. There are many solutions here on SO that suggest using .split(regex, -1) to retrieve all tokens. This is not working, however, when trying it in Groovy.
println ",,,,,,".split(",", -1).length
prints 0
Any idea what I can do about this to get consistent behavior with the Java method? Calling .toString() on it makes no difference (Converting GString to java.lang.String)
edit: I also had String.mixin StringUtils in my script. There is no conflicting method signature since StringUtils does not have a .split(regex, int) method defined. Am I using mixin incorrectly? Is there any way to have this play nicely together?
