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: 
You can use the Template framework in Groovy, so doing this solves your problem:

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

def engine = new groovy.text.SimpleTemplateEngine()
assert 'Hello world!'== engine.createTemplate(stringFromDatabase).make([name:name]).toString()

```

You can find the docs here: <http://docs.groovy-lang.org/latest/html/documentation/template-engines.html#_introduction>

The GString class is abstract, and the GStringImpl implementation of the abstract class works on the arrays of strings, that it gets from the parsing phase along with values.
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.