字符串反转(面试)

将im a student 转换为student a im输出

 private void button1_Click(object sender, EventArgs e)
        {
            this.textBox2.Text=ReverseString(this.textBox1.Text.Trim());

        }

        public string ReverseString(string s)
        {
            char[] chars = s.ToCharArray();
            Array.Reverse(chars);
            return new string(chars);
        }

 

posted @ 2016-05-07 10:13  Leo的日记本  阅读(126)  评论(0编辑  收藏  举报