I want to split at spaces, newlines, and commas.
Here is where I split with the space 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(' ');
You can pass in an array of chars.
string[] docArr = doc.Split(new char[]{' ', '\n', ','});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With