How to replace � in a string

前端 未结 10 564
挽巷
挽巷 2020-11-28 07:50

I have a string that contains a character � I haven\'t been able to replace it correctly.

String.replace(\"�\", \"\");

doesn\'t work, d

10条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-28 08:39

    Use the unicode escape sequence. First you'll have to find the codepoint for the character you seek to replace (let's just say it is ABCD in hex):

    str = str.replaceAll("\uABCD", "");
    

提交回复
热议问题