namespace _041_字符串處理 {
? ? class Program {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? string str = "? www. taikr.COM? ";
? ? ? ? ? ? //str.Length//可以通過.Length訪問到一個字符串的長度
? ? ? ? ? ? //for (int i = 0; i < str.Length; i++)
? ? ? ? ? ? //{
? ? ? ? ? ? //? ? Console.WriteLine(str[i]);
? ? ? ? ? ? //}
? ? ? ? ? ? //string res = str.ToLower();//把字符串轉化成小寫 并返回,對原字符串沒有影響
? ? ? ? ? ? //string res = str.ToUpper();//把字符串轉化成大寫 并返回,對原字符串沒有影響
? ? ? ? ? ? //string res = str.Trim();//去掉字符串前面和后面的空格,對原字符串沒有影響
? ? ? ? ? ? //string res = str.TrimStart();
? ? ? ? ? ? //string res = str.TrimEnd();
? ? ? ? ? ? string[] strArray=str.Split('.');//把原字符串按照指定的字符進行拆分 ,得到一個拆分后的字符串數組
? ? ? ? ? ? Console.WriteLine(str+"|");
? ? ? ? ? ? //Console.WriteLine(res + "|");
? ? ? ? ? ? foreach (string temp in strArray)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine(temp);
? ? ? ? ? ? }
? ? ? ? ? ? Console.ReadKey();
? ? ? ? }
? ? }
}