如何替换字符串中的� [英] How to replace � in a string

查看:21
本文介绍了如何替换字符串中的�的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个字符串,其中包含一个字符 � 我无法正确替换它.

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

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

不起作用,有人知道如何删除/替换字符串中的 � 吗?

doesn't work, does anyone know how to remove/replace the � in the string?

推荐答案

这就是 Unicode 替换字符 uFFFD.(信息)

That's the Unicode Replacement Character, uFFFD. (info)

这样的事情应该可以工作:

Something like this should work:

String strImport = "For some reason my �double quotes� were lost.";
strImport = strImport.replaceAll("uFFFD", """);

这篇关于如何替换字符串中的�的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆