Q:

Java 1.4.2's replace() takes in chars only, how can I get a char value of \n and \r\n carriage returns?

Java 1.4.2's replace() takes in chars only. How can I get a char value of \n and \r\n carriage returns?
\n = Unix carriage return 
\r\n = Windows carriage return

A:

I suspect you'll have to use replaceAll (1.4.2 docs) which takes a regular expression instead - or one of the bazillion StringUtil libraries available, such as the Apache Commons "lang" library.

A:

The char value of \n is simply '\n'.
There's no char value for \r\n, because that's two char values. You'll need to use a different method to do your replacing, if you want to replace that with something else.

A:

You need String.replaceAll();
String ns = s.replaceAll("\\r|\\n", "");

