标签:
1,字符数组去除空格,数组依次左堆积。(尚未实现)
1 char[] cha = { ‘A‘, ‘ ‘, ‘B‘, ‘ ‘, ‘ ‘, ‘C‘, ‘ ‘, ‘a‘, ‘ ‘, ‘ ‘, ‘ ‘, ‘b‘, ‘ ‘, ‘c‘, ‘ ‘, ‘f‘, ‘g‘, ‘1‘, ‘2‘, ‘ ‘, ‘3‘, ‘4‘, ‘5‘, ‘ ‘, ‘6‘ }; 2 for (int i = 0; i < cha.Length; i++) 3 { 4 if (cha[i].ToString() == " ") 5 { 6 for (int j = i; j < cha.Length - i; j++) 7 { 8 //if (cha[j].ToString() == " ") 9 //{ 10 cha[j] = cha[j + 1]; 11 //cha[j + 1] = ‘ ‘; 12 //} 13 } 14 //string charTemp = cha.ToString();// new string(cha); 15 //Console.WriteLine(charTemp); 16 } 17 } 18 string str = new string(cha); 19 Console.Write(str);//AB Ca bcfg123345 666 20 Console.ReadKey();
标签:
原文地址:http://www.cnblogs.com/leee/p/4486551.html