把下载的CSS文件改为可读的形式

时间:2014-04-05 01:07:43   收藏:0   阅读:429

刚下载的CSS文件不分段,难读,所以用c#程序把它换为更可读的形式,

就是在 所有的 "{"之前     和  "}"之后   加回车和换行  

 

程序如下

 

bubuko.com,布布扣
using System.IO;


        private void button1_Click(object sender, EventArgs e)
        {
            //get path
            OpenFileDialog op = new OpenFileDialog();
            op.RestoreDirectory = true;
            op.Filter = "All|*.*|xlsx|*.xlsx";
            if (op.ShowDialog() != DialogResult.OK)
                return;

            textBox1.Text = op.FileName;
        }

        private void button2_Click(object sender, EventArgs e)
        {
          

                string text = File.ReadAllText(textBox1.Text);
                //text = text.Replace("{", "\r\n {");

                text = text.Replace("{", "\r\n {");
                text = text.Replace("}", "} \r\n");


                File.WriteAllText("test.txt", text);

        }
bubuko.com,布布扣

 

 

把下载的CSS文件改为可读的形式,布布扣,bubuko.com

原文:http://www.cnblogs.com/lthxk-yl/p/3645275.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!