文件名称:OperationTXT-3
介绍说明--下载内容均来自于网络,请自行研究使用
首先通过File.ReadAllLines()方法读入文本文档中内容并返回字符串数组contents,这样每行数据就成为了这个字符串数组contents的一个元素,再利用split()方法将每一个元素以空格或制表符分割,返回字符串数组,这样一行数据又被返回了3个字符串放入字符串数组中,通过Convert.ToDouble()方法将其转化为double类型并计算。创建一个StringBuilder数据类型将每行的字符串添加进去,转换为string后,最后用File.WriteAllText方法写入新建的文档。
优点是简单,缺点是只能读入小文档-First () method of reading File.ReadAllLines into a text document and return a string array contents, so that each row of data has become an element of the string array contents, and then use split () method to each element of a space or tab-delimited, returns an array of strings, and a row of data has been returned three string into an array of strings by Convert.ToDouble () method to convert a double type and calculations. Create a StringBuilder string data type each line added to it, converted to string, and finally write the new document with the File.WriteAllText methods. The advantage is simple, the disadvantage is that only a small document read
优点是简单,缺点是只能读入小文档-First () method of reading File.ReadAllLines into a text document and return a string array contents, so that each row of data has become an element of the string array contents, and then use split () method to each element of a space or tab-delimited, returns an array of strings, and a row of data has been returned three string into an array of strings by Convert.ToDouble () method to convert a double type and calculations. Create a StringBuilder string data type each line added to it, converted to string, and finally write the new document with the File.WriteAllText methods. The advantage is simple, the disadvantage is that only a small document read
(系统自动生成,下载前可以参看下载内容)
下载文件列表
OperationTXT-3.docx