I have a set of functions_names that i generate while iterating a list of values. I want to capture these values "functions_names" in a list and use it for further processing. How can i do that?
Thanks
If you want to insert the value of an expression into a string, you can use ${...} (and the deprecated #{...} ) in string literals. ${...} in string literals behaves similarly as in text sections (so it goes through the same locale sensitive number and date/time formatting).
FreeMarker is a template engine, written in Java, and maintained by the Apache Foundation. We can use the FreeMarker Template Language, also known as FTL, to generate many text-based formats like web pages, email, or XML files.
Learn more. Show activity on this post. In my code I am using "\n" for line breaks. It was suggested that I need to avoid "\n" because this is different for different OS (UNIX, windows and MAC) and each operating system would interpret this character differently.
getTemplate(String) (and its overloads) does that (caching Template -s) for you, but the constructor of course doesn't, so it's up to you to solve then. Objects of this class meant to be handled as immutable and thus thread-safe.
FreeMarker doesn't support modifying collections. But if you really want to do this in FreeMarker (as opposed to in Java), you can use sequence concatenation: <#assign myList = myList + [newItem]>
. Here you create a new sequence that wraps the two other sequences. Be aware that the resulting sequence is slow if you try to do indexed access in a long list constructed this way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With