skeletal icon indicating copy to clipboard operation
skeletal copied to clipboard

document using a dollar property for Groovy classes

Open cbmarcum opened this issue 2 years ago • 0 comments

When using a template for a Groovy classes you may have a GString with a Variable ${variable} inside a GString. When the template is processed it will throw an error since it expects a property to replace it with. One solution is to to try to escape the characters but the solution I usually use it to make a variable for the $. Example _result:

println("${operand1} + ${operand2} = ${result}")

To get this... In lazybones.groovy

props.dollar='$'

In the template:

println("${dollar}{operand1} + ${dollar}{operand2} = ${dollar}{result}")

cbmarcum avatar Oct 09 '22 11:10 cbmarcum