On Apr 16, 2009, at 11:38 PM, Sergiu Dumitriu wrote:
Vincent Massol wrote:
Hi,
In the rendering code we have several places where we've had to create generic string manipulation classes/methods (for example a method to remove a single NL at start and end of string). I think it would be better to create one or several components for these string manipulation methods (same as we have xwiki-xml for xml manipulation).
The idea is that we should use existing framework as much as possible (StringUtils from commons lang for ex) but when we cannot find an existing framework to manipulate text then we would put it in xwiki- text.
WDYT?
I don't know if this is really needed. StringUtils is supposed to be the library for string manipulation. Isn't StringUtils.removeStart(content, "\n") + StringUtils.chomp(content) enough?
removeStart removes all NL not only the first one. BTW it's not only "\n" but "\n", "\r" or "\r\n".
If we just need a couple of methods on top of StringUtils, then I'd rather not introduce a new component. Especially one that's as simple as this one.
Where would you put them then? Copy paste them? Right now for ex we have duplication in the 1.0 converter and in the MacroTransformation. -Vincent