阅读的文本文件中使用的StreamReader。
使用(StreamReader的SR =新的StreamReader(文件名,Encoding.Default))
{
串线= sr.ReadLine();
}
我想迫使该行分隔符应 \ñ
不是 \ r
。那么,如何能做到这一点?
字符串文本= sr.ReadToEnd();
字符串[]行= text.Split('\ r');
的foreach(字符串s的线)
{
// 消耗
}
Reading a text file using streamreader.
using (StreamReader sr = new StreamReader(FileName, Encoding.Default))
{
string line = sr.ReadLine();
}
I want to force that line delimiter should be \n
not \r
. So how can i do that?
string text = sr.ReadToEnd();
string[] lines = text.Split('\r');
foreach(string s in lines)
{
// Consume
}