I am creating a program in C # that reads a text file and one of the lines of this file has the following format:
'Column 1' 'Column 2' 'Column 3'
I want to turn this line into an array of strings so that the answer looks like this:
Colunas[0] = "Coluna 1"
Colunas[1] = "Coluna 2"
Colunas[2] = "Coluna 3"
That is, I want it to identify each string within apostrophes and store them in the array. I tried doing this by reading the whole line using the following code:
string Linha = Leitor.ReadLine(); //Leitor é o StreamReader que lê o arquivo
And then I tried to use the method linha.Split
var NomesColunas = linha.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
But then the result was as follows: {"Column", "1", "Column", "2", "Column", "3"}. I tried to use the apostrophe as char
to do the Split but it is giving compilation error, I am not hitting the syntax.