直接调用java.lang.Character类的两个静态函数即可:static char toLowerCase(char ch) Converts the character argument to lowercase using case mapping information from the UnicodeData file. static char toUpperCase(char ch) Converts the character argument to uppercase using case mapping information from the UnicodeData file.
如果是单个字符,用2楼的方法; 如果是字符串,调用String对象的下面两个方法: String toLowerCase() Converts all of the characters in this String to lower case using the rules of the default locale. String toUpperCase() Converts all of the characters in this String to upper case using the rules of the default locale.
Converts the character argument to lowercase using case mapping information from the UnicodeData file. static char toUpperCase(char ch)
Converts the character argument to uppercase using case mapping information from the UnicodeData file.
如果是字符串,调用String对象的下面两个方法:
String toLowerCase()
Converts all of the characters in this String to lower case using the rules of the default locale. String toUpperCase()
Converts all of the characters in this String to upper case using the rules of the default locale.