Chop Newlines
7
mattrmiller
Remove newslines from a string.



kazumaniax
bmax1368
me
jamesmcm
Can
Kelmi
ysg
dannymo2
chorny
wallie
dannyboy
sundaramkumar
mattrmiller
Pio
i_kenneth
ASmith
ctiggerf
sehrgut
bertheymans
SCoon
mattrmiller
public static String chopNewline(String str) {
return(str.replaceAll("\r","").replace("\n",""));
}
// Chop new lines from anywhere in a String
public static String chopAllNewlines(String str)
{
return str.replaceAll( "\n|\r", "" ) ;
}
// Chop new lines from just at the end of a String
public static String chopFinalNewline(String str)
{
return str.replaceAll( "\n$|\r$", "" ) ;
}