作者热门文章
- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
Possible Duplicates:
Remove diacritical marks (ń ǹ ň ñ ṅ ņ ṇ ṋ ṉ ̈ ɲ ƞ ᶇ ɳ ȵ) from Unicode chars
Is there a way to get rid of accents and convert a whole string to regular letters?
我该怎么做?感谢您的帮助
最佳答案
我认为您的问题与以下相同:
因此答案也是一样的:
String convertedString =
Normalizer
.normalize(input, Normalizer.Form.NFD)
.replaceAll("[^\\p{ASCII}]", "");
见
示例代码:
final String input = "Tĥïŝ ĩš â fůňķŷ Šťŕĭńġ";
System.out.println(
Normalizer
.normalize(input, Normalizer.Form.NFD)
.replaceAll("[^\\p{ASCII}]", "")
);
输出:
This is a funky String
关于Java将áéőűú更改为aeouu,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4122170/
我是一名优秀的程序员,十分优秀!