Frage

I see that in many examples it is simply this:

message.replaceAll(nbsp, " ");

Of course it is saying local variable nbsp not found though. How can I simply replace any nbsp in a string with the normal space?

Keine korrekte Lösung

Andere Tipps

You need to create a local variable String nbsp = " "

or simple use message.replaceAll(" ", " ");

This will also work:

message.replaceAll("\u00a0"," ");

Try:

String message = "a b c";
String nbsp = " ";
message = message.replaceAll(nbsp, " ");
System.out.println(message);

Output: "a b c"

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top