Предположим, что у меня есть строка вроде:
MyString = "OU=Level3,OU=Level2,OU=Level1,DC=domain,DC=com";
то я хочу знать, сколько раз времени появления подстроки "OU =" в этой строке. С одним char может быть что-то вроде:
int count = MyString.Split("OU=").Length - 1;
но Split
работает только для char
, а не string
.
Также как найти позицию n вхождений? Например, позиция 2-го "OU="
в строке?
Как решить эту проблему?