[stringtemplate-interest] Truncate string?

Terence Parr parrt at cs.usfca.edu
Tue May 19 10:57:24 PDT 2009


  There is nothing built-in (on purpose), however, you can use a  
formatter for this kind of thing. I believe my paper on  
internationalization or maybe the documentation describes how to do  
this.
Ter
On May 19, 2009, at 10:27 AM, Magdalin, Vlad wrote:

> Hi all,
>
> Does StringTemplate have a way to truncate strings to a certain  
> amount of characters? For example, in NVelocity, I can do something  
> like this:
>
> $formatter.LimitLen(100, $longText, "...")
>
> If ‘longText’ is longer than 100, only the first 100 will be  
> rendered, and the ellipsis is added at the end.
>
> Anything similar available in StringTemplate?
>
> Thanks,
> Vlad
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest



More information about the stringtemplate-interest mailing list