string s = "取子字符串";
string s1 = s.Substring(2, 2);//Substring得到子字符串或字符
Console.WriteLine(s1);
string s2 = s.Remove(0, 2);//Remove移除字符
Console.WriteLine( s2);
string a = "計算機科學";
string a1 = a.Insert(3, "軟件");//Insert插入字符串
Console.WriteLine(a1);
string a2 = a.Replace("計算機", "軟件");//Replace字符串替換
Console.WriteLine(a2);
char[] a3 = a.ToCharArray(0, a.Length);//ToCharArray把string轉換爲字符數組
Console.WriteLine(a3.Length);
string z = "ASDasd";
string z1 = z.ToLower();//ToLower把字符轉換爲小寫
Console.WriteLine(z1);
string z2 = z.ToUpper();//ToUpper把字符轉換爲大寫
Console.WriteLine(z2);
string x = " A zxc ";
x = x.Trim();//Trim刪除字符串頭部及尾部的空格
Console.WriteLine(x);