Convert char to lower case in J2ME without using the Character class

前端 未结 3 665
陌清茗
陌清茗 2021-01-15 16:44

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

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-15 17:04

    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 :

    • grepcode - Character.toLowerCase()

提交回复
热议问题