class ShopService{ def grailsApplication def test(){ grailsApplication.mainContext.getBean…
def salary=7200; def tax=0.00; //只定义到了第5档,这个已经很难达到了 def taxRateMap=[3500:0.03,5000:0.1,800…
def list = [1,2,3,4] println (1 in list)// print true
def rand = new Random() def w = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2] def …
def currentDir = new File("d:/bakup"); def backupFile; def fileText; //Replace the content…
/** * */ @Typed package org.lucifer.db4o import org.lucifer.util.MyLogger import com.db4o.…
//---------------------------------------------------------------------------------- names…
//一般的双目运算符是这样 String name=""; String txt = (!name.equals("")) ? name : "123" //groovy小改进了一…
for (i = 0; i < 5; ++i) { println i }
(123..329).each {if(((it+"${it*2}"+it*3).replaceAll('0','').toCharArray() as Set).size()==…
/** * */ @Typed package org.lucifer.util import static java.lang.Math.* /** * @author Luci…
class XlsController{ /** * 字符串编码 */ final def encode(String value,String charSet='UTF-8'){…