[stringtemplate-interest] format="random string" harmful

tom wible airdrummer at wheel.org
Mon Oct 2 17:32:29 PDT 2006


hi, ter, et al,

i've only used ST for a simple web front-end to a db, and since i'm the 
DBA/tomcat developer/ST author/webmaster, when i need a particular format 
(particularly dates) i just code it into an object method in the servlet & call 
it from the template (& bounce the servlet...internet eXploder loses session so 
often the users never notice having to login just 1 more time;-)

but i can see how that doesn't scale (even though i like 2 keep myself busy 
coding;-) for a large project...so here's my $0.02:

    $numbers:{$it:format="#,##0.0#;(#,##0.0#), "$}$ // using DecimalFormat

    $dates:{$it:format="dd MMM yyyy HH:mm:ss Z"$}$ // using SimpleDateFormat

no, wait:

    $anything:{$it:format="%-10s"$}$ // using java.util.Formatter

i've not used 1.5 yet (but now i have a reason;-) but perhaps the caps this 
could be handled via

	'c', 'C'  	 character 	 The result is a Unicode character

somehow or other...i'll play around with Formatter a bit...
c u


More information about the stringtemplate-interest mailing list