本文介绍了编码新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我想通过代码为程序添加新行的所有可能的帮助
TextReader tr = new StreamReader("c:\\date.txt"); // read a line of text String s1 = tr.ReadLine(); // close the stream //String s1 = "One Two Three Four"; char[] seps = {'' ''}; String[] values = s1.Split(seps); TextWriter tw1 = new StreamWriter("d:\\bdate1.txt"); // write a line of text to the file // close the stream for (int i = 0; i < values.Length; i++) { tw1.WriteLine(values[i]); } tr.Close(); tw1.Close();
解决方案
Hello to all possible help I want to code to add a new line of the program
TextReader tr = new StreamReader("c:\\date.txt"); // read a line of text String s1 = tr.ReadLine(); // close the stream //String s1 = "One Two Three Four"; char[] seps = {'' ''}; String[] values = s1.Split(seps); TextWriter tw1 = new StreamWriter("d:\\bdate1.txt"); // write a line of text to the file // close the stream for (int i = 0; i < values.Length; i++) { tw1.WriteLine(values[i]); } tr.Close(); tw1.Close();
解决方案
这篇关于编码新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!