Remove ASCII Question Mark

被刻印的时光 ゝ 提交于 2019-12-24 14:25:10

问题


I have the following String passed from another application.

2�4�9�

(2�4�9�)

I would like to remove question mark ascii characters from the above string.

How could I do this?


回答1:


According to this Unicode code table, � (or \ufffd) is the character �.

You can remove this unicode character from your string with :

str = str.replaceAll("�", "");

But you should really try to understand why they are there.




回答2:


string.replaceAll("\u0000.*","").replaceAll("[^a-zA-Z0-9 ]", "");

will remove the empty spaces & punctuation marks in the string variable.



来源:https://stackoverflow.com/questions/30231207/remove-ascii-question-mark

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!