I have tried alot of things to get this working but everything I try will compile but will not work.
char[] charDataPairSplits = new char[]
{
':',
','
};
char[] charDataLineSplits = new char[]
{
'\n'
};
strFileText = File.ReadAllText(strDocumentsPath+fileName);
strDataLines = strFileText.Split(charDataLineSplits, StringSplitOptions.RemoveEmptyEntries);
strDataPairs = new string[strDataLines.Length][];
int lineNum = 0;
foreach (string line in strDataLines)
{
if(line != " ")
{
strDataPairs[lineNum++] = line.Split(charDataPairSplits);
}
}
my file looks like this…
Name01, true: Null text goes here 001
Name02, false: Null text goes here 002
Name03, null: Null text goes here 003
So my problem is since there are 4 lines in the text file my strDataPairs[2][0] returns nothing as in “” while strDataLines[2] returns “” as well.
It is not removing the empty line. So what am I doing wrong?