string[] data = lines[j].Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
Why the new is used above? please can someone explain this.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rajendra TripathyPosted Aug 21, 2014, 7:27 AM
The below example demonstrates how to extract individual words from a block of text by treating white space and punctuation marks as delimiters. The character array passed to the separator parameter of the String.Split(Char[]) method consists of a space character and a tab character, together with some common punctuation symbols.
{
public static void Main()
{
string words = "This is a list of words, with: a bit of punctuation" +
"\tand a tab character.";
string [] split = words.Split(new Char [] {' ', ',', '.', ':', '\t' });
foreach (string s in split)
{
if (s.Trim() != "")
Console.WriteLine(s);
}
}
}
// The example displays the following output to the console:
// This
// is
// a
// list
// of
// words
// with
// a
// bit
// of
// punctuation
// and
// a
// tab
// character
VulpesPosted Aug 21, 2014, 7:15 AM
The following overload of the Split method is being called.
http://msdn.microsoft.com/en-us/library/ms131448(v=vs.110).aspx