Last active
September 30, 2016 08:53
-
-
Save jarlrasm/16b3903e9b56c198aaec0957bc54017a to your computer and use it in GitHub Desktop.
C# Find string mismatch(Protip: it is \r\n).There sure must be some easier way to do this.
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
var mismatch = text1.Zip(text2, (x, y) => new { x, y }) | |
.Aggregate(new { total = "", mismatch = "" }, | |
(current, t) => new | |
{ | |
total = current.total + new string(new char[] { t.x }), | |
mismatch = | |
(t.x == t.y) ? current.mismatch : current.total, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment