gpt4 book ai didi

android - 如何在 android 4.2 中使用 toUppercase(locale)?

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:54:33 25 4
gpt4 key购买 nike

enter image description here我使用的是 android 4.2 SDK,我在这行代码上收到警告:

String text0 = tagalogText.getText().toString();
String textA = text0.substring(0, 1).toUpperCase() + text0.substring(1).toLowerCase();

当我将鼠标悬停在它上面时,它会显示:

Implicitly using the default locale is a common source of bugs: Use toUpperCase(Locale) instead.

隐式使用默认语言环境是错误的常见来源:改用 toLowerCase(Locale)。

我从 Java 复制代码,而不是从 Java for android 复制代码。有谁知道如何消除这个错误?为什么它现在成为使用此方法的首选方式?

最佳答案

只需要清理项目

我遇到了同样的问题。我没有依赖默认语言环境,并明确尝试了 Locale.US 和 Locale.English,但仍然收到黄色 Lint 警告。打扫完就走了。

string.toLowerCase(Locale.ENGLISH);

关于android - 如何在 android 4.2 中使用 toUppercase(locale)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17288513/

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