internal static int Count(string whole, string sub) { int ret = 0; while (whole.IndexOf(sub) != -1) { ret++; whole = CutLeading(whole, sub); } return ret; }