On Thursday, March 13, 2003, at 02:18 PM, Carsten Ziegeler wrote:




Hmmm... If you need it, somewhere I have a "collapseWhitespace"
implementation that we use... It's equivalent to trim plus replaces n
occurrences of Char.isWhitespace(x) with a single space char...

Great! I guess that's exactly what we need.
Ehm, just one thought: Is it ok to collapse all whitespaces of the
sql query? Or should we only collapse whitespaces outside of " or ',
so for example a statement like   text = "ggg  hhh  yyy", should
not be collapsed to text = "ggg hhh yyy". This is really more
complicated than it should.

is there not some kind of 'normalise string' method, or am I getting confused with XSLT ? ;)



Luca just suggested to simply use a
String query = StringUtils.replace(sb.toString(), "\r", " ", -1);

So I will try :


- String query = StringUtils.deleteWhitespace(sb.toString());

+ String query = StringUtils.replace(sb.toString(), "\r", " ", -1).trim();


and commit if it works.


Incidentally, '\r' in my Queries never caused me a problem with MySQL.

Thanks for your help.

regards Jeremy



Reply via email to