gpt4 book ai didi

java - 为什么我可以使用 US Ascii Locale 来处理大写/小写的德语变音符号?

转载 作者:行者123 更新时间:2023-11-29 04:44:39 25 4
gpt4 key购买 nike

建议如下代码:

package org.apache.creadur.rat2.core.ds;

import java.util.Locale;

public class TestUsAsciiLocale {
public static void main(String[] pArgs) throws Exception {
final String capitalLetterAe = "\u00c4";
final String smallLetterAe = "\u00e4";
if (capitalLetterAe.toLowerCase(Locale.GERMANY).equals(smallLetterAe)) {
System.out.println("Capital Ae, and small ae are the same (case insensitive) in the german Locale.");
}
if (capitalLetterAe.toLowerCase(Locale.US).equals(smallLetterAe)) {
System.out.println("Capital Ae, and small ae are the same (case insensitive) in the US Locale.");
}
}
}

输出如下:

Capital Ae, and small ae are the same (case insensitive) in the german Locale.
Capital Ae, and small ae are the same (case insensitive) in the US Locale.

我觉得这很奇怪。我希望美国 Ascii 语言环境能够准确对待 [a-zA-Z]可大写/小写。

谢谢,

乔臣

最佳答案

您的代码中存在错误:

    if (capitalLetterAe.toLowerCase(Locale.GERMANY).equals(smallLetterAe)) {
System.out.println("Capital Ae, and small ae are the " +
"same (case insensitive) in the US Locale.");
}

您正在使用 Locale.GERMANY,但消息显示“在美国区域设置”。

关于java - 为什么我可以使用 US Ascii Locale 来处理大写/小写的德语变音符号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37722202/

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