String是Char的只读数组 string s = "abcdefg"; Console.WriteLine(s[0]); //输出a String类型的方法(函数) 把字符串【转换】成char数组:char[] chars = s.ToCharArray(); 把char数组【转换】成字符串:string s = new String(chars); 计算字符串【长度】:int n = s.Length; 把字符串转成【大写】:s.ToUpper(); 把字符串转成【小写】:s.ToLower(); 判断两个字符串【相等】(相等返回true,不等返回false):s1.Equals(s2); s.Equals("123"); 判断两个字符串【相等】(忽略大小写):s.Equals(s2,StringCamparison.OrdinalIgnoreCase); 【分割】字符串,删除不要的字符:string[] str = s.Split(char数组/字符); 判断字符是否【存在】字符串中(存在返回true,不存在返回false):s.Contains("查询内容"); 字符串【替换】:string s2 = s.Replac