处理:用不间断的空间替换空间

时间:2012-05-09 01:41:08

标签: char processing space

在Processing 1.5.1中使用此代码时,我一直收到“Badly formed character constant”的错误。我想用我的String中的非破坏空格替换所有空格。任何帮助将不胜感激。

    String newStr;
    String S = "Hello there world"
    char c = '\u00A0';
    newStr = S.replace(' ', c);

1 个答案:

答案 0 :(得分:1)

处理表示没有引号且前缀为0x的unicode试试这个:

String newStr;
String S = "Hello there world"
char c = 0x00A0;
newStr = S.replace(' ', c);