测试代码在这里。我想增加我当前的正则表达式以逗号分隔
String test = "This Is ,A Test"
println(test)
String noSpace = test.replaceAll("\\s","")
println(noSpace)
String[] words = noSpace.split("[^a-zA-Z0-9'-.]+")
words.each {
println(it)
}
这会产生输出
This Is ,A Test
ThisIs,ATest
ThisIs,ATest
我希望它在哪里产生输出
This Is ,A Test
ThisIs,ATest
ThisIs
ATest
有什么想法吗?谢谢!