leetcode第709题:转换成小写字母

注意字符不仅有26个英文字母,还有特殊字符。特殊字符的话,原样输出。

python 复制代码
public class Solution {
    public char toLowChar(char c){
        if(c>='a'&&c<='z'){
            return c;
        }else if(c>='A'&&c<='Z'){
            int n=(int)c+32;
            return (char)n;
        }
        return  c;
        
    }
    public string ToLowerCase(string s) {
        char[] arr=new char[s.Length];
        for(int i=0;i<s.Length;i++){
            arr[i]=toLowChar(s[i]);
        }
        return new string(arr); 
    }
}
相关推荐
孤飞1 小时前
zero2Agent:面向大厂面试的 Agent 工程教程,从概念到生产的完整学习路线
算法
zjeweler2 小时前
“网安+护网”终极300多问题面试笔记-3共3-综合题型(最多)
笔记·网络安全·面试·职场和发展·护网行动
技术专家2 小时前
Stable Diffusion系列的详细讨论 / Detailed Discussion of the Stable Diffusion Series
人工智能·python·算法·推荐算法·1024程序员节
Hacker_Nightrain2 小时前
详解Selenium 和Playwright两大框架的不同之处
自动化测试·软件测试·selenium·测试工具·职场和发展
csdn_aspnet2 小时前
C# (QuickSort using Random Pivoting)使用随机枢轴的快速排序
数据结构·算法·c#·排序算法
鹿角片ljp3 小时前
最长回文子串(LeetCode 5)详解
算法·leetcode·职场和发展
paeamecium4 小时前
【PAT甲级真题】- Cars on Campus (30)
数据结构·c++·算法·pat考试·pat
chh5635 小时前
C++--模版初阶
c语言·开发语言·c++·学习·算法
RTC老炮5 小时前
带宽估计算法(gcc++)架构设计及优化
网络·算法·webrtc
dsyyyyy11016 小时前
计数孤岛(DFS和BFS解决)
算法·深度优先·宽度优先