My question is how can i split the words inside this .txt file
string filePath = @"..\..\Tekst.txt";
List<string> lines = new List<string>();
lines = File.ReadAllLines(filePath).ToList();
foreach (string line in lines)
{
Console.WriteLine(line);
}
Here is how i want to split it. I want it to split every time there is space, ",", ".", "!" and "?". But when i do that it comes out with an error
string[] wordsArray = lines.Split(' ', ',', '.', '!', '?');
foreach (string line in wordsArray)
{
Console.WriteLine(line);
}