简体   繁体   中英

Remove ASCII Question Mark

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?

According to this Unicode code table , � (or \� ) 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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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