Freemarker chunk.

 This built-in splits the sequence into multiple sequences of the size specified by the first built-in parameter (such as mySeq? Chunk (3)). The result is the result of these results. Unless a second parameter (mySeq? Chunk (3, `'), etc.) is specified, the final sequence can be shorter than the specified size. example:


<#assign seq = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']>

<#list seq?chunk(4) as row>

  <#list row as cell>${cell} </#list>

</#list>


<#list seq?chunk(4, '-') as row>

  <#list row as cell>${cell} </#list>

</#list> 

output:

 a b c d 

  e f g h 

  i j 

  a b c d 

  e f g h 

  i j - - 

No comments

Theme images by hdoddema. Powered by Blogger.