All Downloads are FREE. Search and download functionalities are using the official Maven repository.

g0701_0800.s0709_to_lower_case.Solution Maven / Gradle / Ivy

There is a newer version: 1.37
Show newest version
package g0701_0800.s0709_to_lower_case;

// #Easy #String #Programming_Skills_I_Day_9_String
// #2022_03_23_Time_1_ms_(71.74%)_Space_42_MB_(52.94%)

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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy