• C#在文本文件的每行后加分号


     

    Authorquietwalk

    Date2010-10-28


     

    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;

     

    using System.IO;

     

    namespace ReadLine

    {

        public partial class Form1 : Form

        {

            public Form1()

            {

                InitializeComponent();

            }

     

            private void btnConvert_Click(object sender, EventArgs e)

            {

                string oldValue = string.Empty, newValue = string.Empty;

     

                StreamWriter writer = new StreamWriter(@"d:\\diccode_destination.txt", true,Encoding.Default);

                using (StreamReader read = new StreamReader(@"d:\\diccode_orginal.txt", System.Text.Encoding.Default,true))//txt 文件默认是 GB2312格式编码

                {

                   

                    do

                    {

                        newValue = read.ReadLine();

                        oldValue = newValue != null ? newValue+";" : oldValue;

                        writer.WriteLine(oldValue);

                    } while (newValue != null);

     

                    read.Close();

                    writer.Close();

                }

     

            }

        }

    }

  • 相关阅读:
    Microsoft To-Do无法同步问题 ke xue上网导致
    学习希尔排序
    查找docker无法启动的原因
    挂载只读分区为可读写
    批量重建索引脚本
    frp nginx 80 端口共用
    vue部署nginx 404
    阿里云服务器,数据库热备、暖备、冷备实战-镜像篇(域环境下配置)
    码农老婆的网店
    Wcf调用方式
  • 原文地址:https://www.cnblogs.com/quietwalk/p/1863260.html
Copyright © 2020-2023  润新知