I want to replace the \n character with a space. The below code in not working. Any suggestions?
System.out.println("Enter a string:");
Scanner sc=new Scanner(System.in);
String str=sc.nextLine().toString();
//String str="one\ntwo";
if(str.contains("\\n")){
System.out.println("yes");
str=str.replaceAll("\\n", " " );
}
System.out.println("str : "+str);
The input string is one\ntwo
in java](http://stackoverflow.com/questions/3056834/replace-n-and-r-n-with-br-in-java) – Kick Buttowski Oct 05 '14 at 18:14