gpt4 book ai didi

c# - 如何从文件中拆分我想要的文本?

转载 作者:太空宇宙 更新时间:2023-11-03 18:01:22 25 4
gpt4 key购买 nike

嗨,这是我在文件中得到的内容:

AT+CMGL="ALL"  +CMGL: 6123,"REC READ","+923315266206"  B confident dat GOD can make a way wen der seems 2 b no way. Even wen your mind may waver, GOD is working bhind d scenes on yur behalf. Have a faith-filled day  +CMGL: 6122,"REC READ","+923315266206"  B confident dat GOD can make a way wen der seems 2 b no way. Even wen your mind may waver, GOD is working bhind d scenes on yur behalf. Have a faith-filled day---------------------------------------------------------------------------------

我只想获取行,即文件中的文本。比如“B confident......waver”。我该怎么做?

我试过拆分但我无法让它运行......:)

最佳答案

使用 StreamReader 读取文件并使用 ReadLine 方法,这将一次读取文件一行。

using (StreamReader reader = File.OpenText(fileName))
{
while (!reader.EndOfStream)
{
string line = reader.ReadLine();
// do something with the line
}
}

关于c# - 如何从文件中拆分我想要的文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/911990/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com