liuzhaohong 发表于 2013-1-27 05:04:20

字符串分隔并保存在指定目录下

近期真是学了不少东东,现在拿出来分享一下

using System.IO;

namespace Demo
{
    public partial class Form1 : Form
    {
      int i = 0;
      public Form1()
      {
            InitializeComponent();
      }

      private void button1_Click(object sender, EventArgs e)
      {
            string aa = "110110000013136068119550212003420080623120112";
            string aaa = aa.Insert(13, ",");
            aaa = aaa.Insert(32,",");
            this.richTextBox1.Text = aaa;

            StreamWriter sw = File.CreateText("C:\\GAJ_PUB\\kaoqin\\aa"+i+".txt");

//注意:C:\\GAJ_PUB\\kaoqin\\必须存在哦~~
            
            sw.WriteLine(aaa);

            sw.Flush();

            sw.Close();
            i++;
            MessageBox.Show("文件生成成功!!");
      }
    }
}
页: [1]
查看完整版本: 字符串分隔并保存在指定目录下