Repeat a string n times in freemarker

Requirement: Need to repeat a string of characters n times, where n is a variable

Solution: Use list to iterate a range:

<#assign n = 5>
<#list 0..<n as i>hello</#list>

Leave a comment

Your email address will not be published. Required fields are marked *