标签:ascii toc rar 大小 return for 转化 public pre
public String toLowerCase(String str){
char[] chars = str.toCharArray();
for (int i = 0; i < chars.length; i++) {
if ('A' <= chars[i] && chars[i]<= 'Z'){
chars[i] += 32;
}
}
return String.valueOf(chars);
}
public String toLowerCase(String str){
char[] chars = str.toCharArray();
for (int i = 0; i < chars.length; i++) {
if ('a' <= chars[i] && chars[i]<= 'z'){
chars[i] -= 32;
}
}
return String.valueOf(chars);
}
在java中,字符使用的是ascii码,大写字母和其对应的小写字母差32
标签:ascii toc rar 大小 return for 转化 public pre
原文地址:https://www.cnblogs.com/lisongyu/p/10028072.html