gpt4 book ai didi

Java将áéőűú更改为aeouu

转载 作者:IT老高 更新时间:2023-10-28 20:52:19 26 4
gpt4 key购买 nike

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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com