Convert char to lower case in J2ME without using t

2019-02-20 02:09发布

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!

3条回答
放我归山
2楼-- · 2019-02-20 02:32

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.

查看更多
等我变得足够好
3楼-- · 2019-02-20 02:45

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 :

查看更多
仙女界的扛把子
4楼-- · 2019-02-20 02:57
char toLowerCase(char c){
    if(c>=97 && c<=122)
        return (char) (c-32);
    else
        return c;
}
查看更多
登录 后发表回答