You need to create a local variable String nbsp = " "
or simple use message.replaceAll(" ", " ");
This will also work:
message.replaceAll("\u00a0"," ");
题
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?
没有正确的解决方案
其他提示
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"