Question

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?

No correct solution

OTHER TIPS

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"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top