Frage

below code can not run

def map = [name:"Test :: ( %2f %25 \$ * & ! @ # ^)"]
String s = map.inspect()
println Eval.me(s)

get error:

Script1.groovy: 1: illegal string body character after dollar sign; 

solution: either escape a literal dollar sign "\$5" or bracket the value expression "${5}" @ line 1, column 30.
   ["name":"Test :: ( %2f %25 $ * & ! @ # ^)"]

but if string contain other special char like \", it works correctly. any way, how to walk around? it's emergency for me

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top