public class Solution { public string ToLowerCase(string str) { var sb = new StringBuilder(str); for (var i = 0; i < sb.Length; ++i) { char c = sb[i]; if (c >= 'A' && c <= 'Z') { sb[i] = (char)(c + ('a' - 'A')); } } return sb.ToString(); } }Source: https://leetcode.com/problems/to-lower-case/
No comments:
Post a Comment