Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
任何人都可以解释以下内容吗?
println('x' ==~ /x/) println('x' !=~ /x/)
结果:
true true
groovy中没有!=~运算符。它是!=和的组合~。
!=~
!=
~
println('x' !=~ /x/)
相当于
println('x' != (~ /x/))
你需要的是
println(!('x' ==~ /x/))