Question: I want to read a String from database and replace the placeholder by converting it to a GString. Can I do this with Eval? Any other ideas?

```
String stringFromDatabase = 'Hello ${name}!'
String name = 'world'

assert 'Hello world!'== TODO

```

Answer: 
I solved this with [Eval](http://docs.groovy-lang.org/latest/html/api/groovy/util/Eval.html):

```
String stringFromDatabase = 'Hello ${name}!'
String name = 'world'

assert 'Hello world!' == Eval.me('name', name, '"' + stringFromDatabase + '"')

```
This also uses the Templates as Jacob's answer, but tries to resolve binding from current variables. Useful if you don't know what value you are replacing:

```
String stringFromDatabase = 'Hello ${name}!'
// variables w/o type or def keyword end up in this.binding.variables
name = 'world'

def engine = new groovy.text.SimpleTemplateEngine()
assert 'Hello world!'== engine.createTemplate(stringFromDatabase).make(this.binding.variables).toString()

```

CAVEAT: variables that can be replaced don't have type or def keyword.