Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static List<int> AllIndexesOf(string str, string value)
- {
- if (String.IsNullOrEmpty(value))
- throw new ArgumentException("the string to find may not be empty", "value");
- List<int> indexes = new List<int>();
- for (int index = 0; ; index += value.Length)
- {
- index = str.IndexOf(value, index);
- if (index == -1)
- return indexes;
- indexes.Add(index);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement