Created
August 23, 2018 19:08
-
-
Save erdembayar/4d0d37b63be343538f98728cdac0584b to your computer and use it in GitHub Desktop.
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
public static IEnumerable<int> FindAll(this string str, string sub) | |
{ | |
if (sub.Length < 1) | |
yield break; | |
var index = 0; | |
while (true) | |
{ | |
index = str.IndexOf(sub, index + 1, StringComparison.InvariantCultureIgnoreCase); | |
if (index == -1) | |
break; | |
yield return index; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment