I have a java string with \" \"
from a text file the program accesses with a Buffered Reader object. I have tried string.replaceAll(\"
This is a two step process:
strLineApp = strLineApp.replaceAll("&"+"nbsp;", " ");
strLineApp = strLineApp.replaceAll(String.valueOf((char) 160), " ");
This worked for me. Hope it helps you too!
I encountered the same problem: The inner HTML of the element I needed had " " and my assertion failed. Since the question has not accepted any answer,yet I would suggest the following, which worked for me
String string = stringwithNbsp.replaceAll("\n", "");
P.S : Happy testing :)
Strings are immutable so You need to do
string = string.replaceAll(" ","")
cleaned = cleaned.replace("\u00a0","")
You can use JSoup library:
String date = doc.body().getElementsByClass("Datum").html().toString().replaceAll(" ","").trim();
String
s in Java are immutable. You have to do:
String newStr = cleaned.replaceAll(" ", "");