[stringtemplate-interest] Newlines...
Terence Parr
parrt at cs.usfca.edu
Tue Oct 10 14:41:39 PDT 2006
On Oct 3, 2006, at 7:40 AM, Hill, Robert wrote:
> When I add a separator="\n"; on the PC Stringtemplate (as part of
> antlr
> 3.0b4) is emitting only LF's instead of the CR+LF combination.
Correct. \n is just \n in a string. Use \r\n. Though of course
it's not sensing what platform it is on, I think that is generally
what you want in a template. <\n> should do the right thing but I am
not sure if separator={<\n>} works.
Ter
>
> Am I missing a setting somewhere?
> Thanks!
> Rob
>
>
> --
> Rob Hill
> EDS - Hallamshire Business Park
> F1E/045
> Sheffield
> T: +44 (0) 114 291 1928
> M: +44 (0) 791 732 1227
> E: rhill03 at eds.com
>
>
>
>> -----Original Message-----
>> From: stringtemplate-interest-bounces at antlr.org
>> [mailto:stringtemplate-interest-bounces at antlr.org] On Behalf
>> Of tom wible
>> Sent: 03 October 2006 01:32
>> To: stringtemplate-interest at antlr.org
>> Subject: Re: [stringtemplate-interest] format="random string" harmful
>>
>> 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
>> _______________________________________________
>> stringtemplate-interest mailing list
>> stringtemplate-interest at antlr.org
>> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest
>>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest
More information about the stringtemplate-interest
mailing list