g0701_0800.s0709_to_lower_case.Solution Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leetcode-in-java Show documentation
Show all versions of leetcode-in-java Show documentation
Java-based LeetCode algorithm problem solutions, regularly updated
package g0701_0800.s0709_to_lower_case;
// #Easy #String
public class Solution {
public String toLowerCase(String s) {
char[] c = s.toCharArray();
for (int i = 0; i < s.length(); i++) {
if (c[i] <= 'Z' && c[i] >= 'A') {
c[i] = (char) (c[i] - 'A' + 'a');
}
}
return new String(c);
}
}