您的位置:首页 > 其它

丶将字符串的每个字符进行颠倒输出

2011-10-19 22:51 302 查看
using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

namespace Example41

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void textBox1_TextChanged(object sender, EventArgs e)

{

char[] P_chr = textBox1.Text.ToCharArray(); //从字符串中得到字节数组

Array.Reverse(P_chr, 0, textBox1.Text.Length); //反转字节数组

textBox2.Text = new StringBuilder().Append(P_chr).ToString(); //将字节数组转换为字符串输出

}

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐