get value of the string stored in a variable, whose name stored as string in another variable

StackOverflow https://stackoverflow.com/questions/21276930

  •  01-10-2022
  •  | 
  •  

Question

<#assign blah = "foo">
<#assign foo = "awesome">

Can we render "awesome" without referencing foo ?

I tried something like ${${blah}}

But it isn't working, any ideas ?

Was it helpful?

Solution

There is an eval built-in which evaluates a string as an FTL expression.

In your case use it like this:

${blah?eval}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top