Handling CRLF in String

Hey guys, I read the forums alot, love them but this is my first post.

I have a string and I am replacing every space with a '+' but does anyone know how I can detect a carriage return and line feed (CRLF) within the string so I can replace this with a '+' much like the spaces?

Here's the code I'm using to replace every space with a +.

for (int x=0; outgoingSmsMsg.length(); x++ {

if (outgoingSmsMsg.charAt(x) == ' ' {

outgoingSmsMsg = outgoingSmsMsg.replace(' ', '+');

}

}

Regards,

Digi.

[563 byte] By [digitaldeatha] at [2007-11-26 15:25:55]
# 1
Depends on which platform you are using. The platform independabnt way is:System.getProperty("line.separator");
floundera at 2007-7-8 21:41:35 > top of Java-index,Java Essentials,Java Programming...
# 2
Well, I need a solution that fits in with the code I currently have implemented for detecting the spaces and replacing them. Code examples would be greatly appreciated.Regards,Digi.
digitaldeatha at 2007-7-8 21:41:35 > top of Java-index,Java Essentials,Java Programming...
# 3
String has a replaceAll(...) method.
camickra at 2007-7-8 21:41:35 > top of Java-index,Java Essentials,Java Programming...
# 4
Replace that whole loop with this statement: outgoingSmsMsg = outgoingSmsMsg.replaceAll("\\s+", "+");
uncle_alicea at 2007-7-8 21:41:35 > top of Java-index,Java Essentials,Java Programming...