Created
July 8, 2016 00:30
-
-
Save yareally/3ca09fb1773b68004f2bc261409fb392 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 haystack = "AABBCC"; | |
var matches = rules.Where(kv => haystack.Contains(kv.Key)).ToDictionary(kv => kv.Key, kv => kv.Value); | |
var needle = matches.Any() ? matches.ElementAt(new Random().Next(matches.Count)).Key : ""; | |
haystack.Replace(needle, rules[needle]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment