Equivalent of String.join() in mustache

512 views
Skip to first unread message

Sergey Ermakov

unread,
Jan 28, 2019, 5:14:12 AM1/28/19
to mustache.java
Hello, I would like to render list, separated by comma:
1, 2, 3, 4, 5

But when I am rendering by template "{{#names}}'{{.}}', {{/names}}.",
I get "'1', '2', '3', '4', '5', "

How can I render list , without last comma?

Sam Pullara

unread,
Jan 28, 2019, 12:04:19 PM1/28/19
to mustac...@googlegroups.com
There is a util called DecoratedCollection that adds methods that can help you do this like first, last, etc. Here are the tests that shows you how it works:


Sam


--
You received this message because you are subscribed to the Google Groups "mustache.java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mustachejava...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages