I have this string:
My name is Marco and I'm from Italy
I'd like to split it, with delimiter is Marco and
, so I should get an array with
My name
at [0] andI'm from Italy
at [1].How can I do it with C#?
I tried with:
.Split("is Marco and")
But it wants only a single char.
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(',');