在 J2ME 中将 char 转换为小写而不使用 Character 类

发布于 2024-09-19 04:53:19 字数 162 浏览 3 评论 0原文

我想在 J2ME 应用程序中将 char 转换为小写。通常的 Character.toLowerCase() 不适用于 J2ME 中的任意 Unicode 字符,因此我需要一些轻量 API,或者最好是一段代码这样做。

谢谢!

I'd like to convert a char to lower case in a J2ME app. The usual Character.toLowerCase() doesn't work for an arbitrary Unicode character in J2ME, so I need some light API, or, preferably, a piece of code that would do so.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

笔落惊风雨 2024-09-26 04:53:19

基于 JavaSE JDK 中 CharactertoLowerCase() 方法:

char lowerChar = (char)CharacterData.of((int)upperChar).toLowerCase((int)upperChar);

您可以从 JDK 中阅读源代码,了解这里真正做了什么,并将同样的事情应用到您的应用程序中。 JME 中自己的类。


资源:

Based on the toLowerCase() method from Character in JavaSE JDK:

char lowerChar = (char)CharacterData.of((int)upperChar).toLowerCase((int)upperChar);

You can read the source code from the JDK and understand what is really done here and apply the same thing with your own classes in JME.


Resources :

总以为 2024-09-26 04:53:19
char toLowerCase(char c){
    if(c>=97 && c<=122)
        return (char) (c-32);
    else
        return c;
}
char toLowerCase(char c){
    if(c>=97 && c<=122)
        return (char) (c-32);
    else
        return c;
}
秋心╮凉 2024-09-26 04:53:19

我刚刚复制了 Java SE 1.3 中的一些内容并将其包含在我的 J2ME 应用程序中。一般来说,它是来自 Character 类的一些方法和三个大数组。

I just copied some of the stuff from Java SE 1.3 and included it in my J2ME app. Generally, it's a few methods and three big arrays from the Character class.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文