Пример #1
0
        public void Count()
        {
            int result = TextUtils.Count("bad candy bad", "bad");

            Assert.AreEqual(2, result);

            result = TextUtils.Count("bad candy bad", "a");
            Assert.AreEqual(3, result);

            result = TextUtils.Count("bad candy bad", "z");
            Assert.AreEqual(0, result);
        }
Пример #2
0
 /// <summary>
 /// Search number of <paramref name="matchString"/>s are in input string
 /// </summary>
 /// <param name="inputString">String to search</param>
 /// <param name="matchString">Value being searched for</param>
 /// <returns>Number of <paramref name="matchString"/> occurances in <paramref name="inputString"/></returns>
 public static int Count(this string inputString, string matchString)
 {
     return(TextUtils.Count(inputString, matchString));
 }