本帖最后由 杞文明 于 2013-3-15 20:38 编辑
- static void Main(string[] args)
- {
- string s = "hello c sharp";
- string ss = "";
- string[] lines = s.Split(' '); //把字符分隔出来
- foreach (string line in lines)
- {
- for (int i =line.Length-1; i >=0; i--)
- {
- ss = ss + line[i]; //倒着去字符
- }
- ss = ss + " ";
- }
- Console.WriteLine("转换之前{0}",s);
- Console.WriteLine("转换之后{0}", ss);
- Console.ReadKey();
- }
复制代码
|