Reputation:
var playerBeginMarker = "splitHere!";
string[] playerInfoSet = endgameStats.Split(playerBeginMarker, StringSplitOptions.None);
I'd like to split the endgameStats string, using that playerBeginMarker as the delimiter but it seems to only accept a char.
Upvotes: 3
Views: 153
Reputation: 30872
Use String.Split Method (String(), StringSplitOptions). You would use a String
array with one element within - the string you wish to split on.
So it would be:
String[] output = String.Split(new String[]{"splitHere!"}, StringSplitOptions.None)
Upvotes: 1
Reputation: 12235
Use this .Split()
overload:
Console.WriteLine("{0}", "moofoobar".Split(new string[] {"o"}, StringSplitOptions.RemoveEmptyEntries));
Upvotes: 6