new File('.').metaClass.methods.join('\n') でメソッド一覧を見れる。
def cl = evaluate('cl = {println it*10}') (1..10).each(cl)
def cl = evaluate('({println it*10})') (1..10).each(cl)
[1,2,3,4,5].sort {l, r -> (l <=> r) * -1 }
println ([4,2,1,3].sort{ a, b -> println "a = $a, b = $b" a<=>b })
a = 4, b = 2 a = 4, b = 1 a = 2, b = 1 a = 4, b = 3 a = 2, b = 3 [1, 2, 3, 4]
list = [[age:2,name:'bb'], [age:2,name:'aa'], [age:0,name:'zz']] println list.sort({a,b -> a.age <=> b.age ?: a.name <=> b.name})
str = /c:¥Documents and Settings¥fujwara¥Documents/ println (str.replaceAll(/¥/, "/"))
str = /c:¥Documents and Settings¥fujwara¥Documents/ println str.replaceAll(/¥/, "/")
// linuxだと動く def str = /c:¥Documents and Settings¥fujwara¥Documents/ println str.replaceAll("¥", "/")
def html = new URL("http://google.com").text (html =~ /(?ms)<input[^>]*?>/).each{ println it }
The permalink for this message is: