mardi 31 mars 2015

Groovy String evaluation runtime

Hi I have a String value that is populated runtime and I want to use it to construct another String.



static value= ''
static construct = "${-> value - '/'}"


So when I value = "/http://ift.tt/fyw30c" , construct is equal to "http://ift.tt/fyw30c"


but when I do



static value= ''
static construct = {-> value - '/'}


construct is equals to some closure name. I am wondering what is the purpose of this? Why using closure,GString everything is ok? And why when use only closure nothing happens?


Aucun commentaire:

Enregistrer un commentaire