标签:solution pre amp array toc for bsp ++ str
709. To Lower Case
题目描述:将字符串中的所有大写字母转换成小写字母并返回新的字符串。
class Solution { public String toLowerCase(String str) { char[] arr = str.toCharArray(); for (int i = 0; i < arr.length; i++) { if (arr[i] >= ‘A‘ && arr[i] <= ‘Z‘) { arr[i] = (char)(arr[i] - ‘A‘ + ‘a‘); } } return String.valueOf(arr); } }
标签:solution pre amp array toc for bsp ++ str
原文地址:https://www.cnblogs.com/mrjoker-lzh/p/10259405.html