且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将一列文本文件复制到另一个文本文件

更新时间:2023-11-27 22:30:40

如果您逐行阅读文件,那么您可以分开每行中的字段使用 String.Split [ ^ ]方法。然后,您可以将第一个字段写入新文件。您可以使用 Int32.TryParse [ ^ ]方法。这将允许您对第三列求和。
If you read the file line by line then you can separate the fields in each line by using the String.Split[^] method. You can then write the first field out to a new file. You can convert the third field to an integer value with the Int32.TryParse[^] method. That will allow you to sum the third column.