Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you show list length in StringTemplate

I want to show the number of search results that are going to appear in the table, is there a way to show the number of elements or do you have to compute it, ie I want to show something like this:

Found $results.size$ result$if(rest(contacts))$s$endif$.

The "s" correctly shows when there is more than one search result, but the $results.size$ returns nothing. Not sure if it matters, but im using Java, so its a List thats being passed in.

like image 579
Jay Avatar asked Oct 06 '22 09:10

Jay


1 Answers

Found the answer, there is a length() function, ie:

Found $length(results)$ result$if(rest(contacts))$s$endif$.
like image 76
Jay Avatar answered Oct 10 '22 01:10

Jay