In some C# code I saw default(string[])
is null
, but the behavior looks like it is splitting based on whitespace:
string[] x = "1 2 3".Split(default(string[]), StringSplitOptions.RemoveEmptyEntries);
string[] y = "1,2, 3".Split(default(string[]), StringSplitOptions.RemoveEmptyEntries);
Here, x
becomes string[3] = {"1","2","3"}
, y
becomes string[2] = {"1,2,","3"}
.
My input string can be separated using whitespace or comma i.e."1 2 3" OR "1,2, 3". But i want output to be numeric array string i.e. {"1","2","3"}
How can I achieve this?