我想分隔空格,换行符和逗号.
这是我用空格char分割的地方:
StreamReader sr1 = new StreamReader("E:\\Lectures\\Fourth year\\2nd term\\IR\\Sections\\Files\\Files\\Document2.txt");
string doc = sr1.ReadLine();
string[] docArr = doc.Split(' ');
Run Code Online (Sandbox Code Playgroud)
你可以传入一系列字符.
string[] docArr = doc.Split(new char[]{' ', '\n', ','});
Run Code Online (Sandbox Code Playgroud)