正則表達式就像一把瑞士軍刀。 "potatoe" ==~ /potatoe/  假如你在groovyConsole運行它,將返回true.這裡有兩件需要注意的事情: 1.==~操作符。它類似于==操作符,但是用於匹配模式而不是計算相等性。 2.正則表達式包含在 '/'中.它會告訴Groovy這是個正則表達式而不是String. "potatoe" ==~ /potatoe?/ "potato" ==~ /potatoe?/  這裡?表達的意思是'e'是可選的。 "motato&qu ...
(-)变量 你可以给变量赋值. 像下面: x = 1 println x x = new java.util.Date() println x x = -3.1499392 println x x = false println x x = "Hi" println x  (二)Lists and Maps Groovy已经内置支持两种重要的数据类型, lists 和maps((Lists就像java中的数组一样来操作))Lists用来存储有序集合数据,例如: myList = [1776, -1, 33, 99, 0, 92873 ...