[stringtemplate-interest] Output string lengths..
John Snyders
jjsnyders at rcn.com
Mon Dec 11 14:39:54 PST 2006
So, We could do the following $name; format="%50s"$, right? then
someone would have to make a string renderer, but that is easy.
Ter
The trouble is that for a single type there is one renderer so it must
handle all needed formats.
$name;format="pad,20"$ then later $name;format="upperCase"$ A renderer for
the format option can do whatever it wants with the argument but in some
cases it would pass it to String.format and other times it will do something
else. Trouble? Is this not a user/ system implementers problem?
[John Snyders] Yes user implementation issue. Not a problem from the
desing of format option point of view.
One could use a hash table to look up the operator names
and default to String.format. Perhaps the implementor wants to support the
following: pad(20,'x') or remove('abc')... or whatever... they will do
that if
the want to.
BTW String.format/Formater is new in Java 1.5. Yes I noted that. There are
other open source libraries available for doing something similar
for earlier versions.... again that is a system implementers problem is it
not?
[John Snyders] Yes
The renderer must be
able to distinguish one argument value from another. If you wanted to use
the format argument as the argument to String.format I guess you could check
to see that it contains a '%'.
The other issues I raised about where format applies Surely to the
attributes and the result of templates expansion?
I may have missed the point.
and why can't options
take multiple parameters are still unanswered.
I think I missed that... Can you point it out again.
[John Snyders] Under #5 here
http://www.antlr.org:8080/pipermail/stringtemplate-interest/2006-December/00
0857.html
also
http://www.antlr.org:8080/pipermail/stringtemplate-interest/2006-December/00
0847.html under interesting thing #2
Cheers
Caleb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org:8080/pipermail/stringtemplate-interest/attachments/20061211/bd829f38/attachment.html
More information about the stringtemplate-interest
mailing list