[stringtemplate-interest] Output string lengths..
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.
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
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
[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
0847.html under interesting thing #2
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the stringtemplate-interest