Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. public static List<int> AllIndexesOf(string str, string value)
  2. {
  3. if (String.IsNullOrEmpty(value))
  4. throw new ArgumentException("the string to find may not be empty", "value");
  5. List<int> indexes = new List<int>();
  6. for (int index = 0; ; index += value.Length)
  7. {
  8. index = str.IndexOf(value, index);
  9. if (index == -1)
  10. return indexes;
  11. indexes.Add(index);
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement