Re: Text to String literal conversion




Patricia Shanahan wrote:
In connection with writing some unit tests, I need a utility to convert
text output to a String constant expression.

http://www.snible.org/java2/uni2java.html is almost exactly what I want,
but I would prefer the literals broken at newlines and concatenated.
That is:

aaa\bbb
kkk


gets converted to "aaa\\bbb\nkkk\n". I would prefer:

"aaa\\bbb\n" +
"kkk\n"

This seems like a wheel that should already exist, so I would rather not
invent it myself.

freemarker.template.utility.StringUtil
Should get you as close as the above mentioned.
<http://freemarker.org/>

Patricia


.