Facebook
From pablo escobaro, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 193
  1.     public static int countSubStr(String str, String substr) {
  2.  
  3.         int ilosc = 0;
  4.         for (int i = 0; i < str.length() - substr.length() + 1; i++)
  5.             if (str.substring(i, i + substr.length()).equals(substr))
  6.                 ilosc++;
  7.         return ilosc;
  8.     }