How can I split a string with a string delimiter?
.Split(new string[] { "is Marco and" }, StringSplitOptions.None)
Consider the spaces surronding "is Marco and"
. Do you want to include the spaces in your result, or do you want them removed? It's quite possible that you want to use " is Marco and "
as separator...
string[] tokens = str.Split(new[] { "is Marco and" }, StringSplitOptions.None);
If you have a single character delimiter (like for instance ,
), you can reduce that to (note the single quotes):
string[] tokens = str.Split(',');