Created
February 8, 2012 10:40
-
-
Save skalinets/1768041 to your computer and use it in GitHub Desktop.
What it would be if String.Split() did not accept muptiple delimiters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public void selectManyTest() | |
{ | |
var s = "2#3,4%5"; | |
var delimiters = "#,%"; | |
var e = delimiters | |
.Aggregate(Enumerable.Repeat(s, 1), (current, delimiter) => | |
current.SelectMany(s1 => s1.Split(delimiter))); | |
e.Should().Equal(new[] {"2", "3", "4", "5"}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment