简体   繁体   English

删除ASCII问号

[英]Remove ASCII Question Mark

I have the following String passed from another application. 我从另一个应用程序传递了以下字符串。

2�4�9�

(2 4 9 ) (249)

I would like to remove question mark ascii characters from the above string. 我想从上面的字符串中删除问号ascii字符。

How could I do this? 我怎么能这样做?

According to this Unicode code table , � 根据此Unicode代码表� (or \� ) is the character . (或\�角色 。

You can remove this unicode character from your string with : 您可以使用以下命令从字符串中删除此unicode字符:

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

But you should really try to understand why they are there. 但你应该真的试着理解它们为什么存在。

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

将删除字符串变量中的空格和标点符号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM