我想在txt文件中找到一个字符串,如果字符串比较,它应该继续读取行,直到我用作参数的另一个字符串.
例:
CustomerEN //search for this string
...
some text wich has details about customer
id "123456"
username "rootuser"
...
CustomerCh //get text till this string
Run Code Online (Sandbox Code Playgroud)
我需要细节与他们合作.
我正在使用linq来搜索"CustomerEN",如下所示:
File.ReadLines(pathToTextFile).Any(line => line.Contains("CustomerEN"))
Run Code Online (Sandbox Code Playgroud)
但现在我仍然坚持阅读行(数据)直到"CustomerCh"来提取细节.
c# ×1