@Test public void testCount() { String src = "oh,hello,world!ha!ha!"; Assert.assertEquals(1, StringUtil.count(src, "oh")); Assert.assertEquals(2, StringUtil.count(src, "ha")); Assert.assertEquals(3, StringUtil.count(src, "!")); System.out.println(String.format("[CRAFT-ATOM-UTIL] (^_^) <%s> Case -> test count. ", CaseCounter.incr(3))); }
public static int count(String src, String target) { int count = 0; int index = src.indexOf(target); while (index != -1) { count++; index = src.indexOf(target, index + 1); } return count; }
StringUtil { public static int count(String src, String target) { int count = 0; int index = src.indexOf(target); while (index != -1) { count++; index = src.indexOf(target, index + 1); } return count; } }
StringUtil { public static int count(String src, String target) { int count = 0; int index = src.indexOf(target); while (index != -1) { count++; index = src.indexOf(target, index + 1); } return count; } private  StringUtil(); }
StringUtil { public static int count(String src, String target) { int count = 0; int index = src.indexOf(target); while (index != -1) { count++; index = src.indexOf(target, index + 1); } return count; } private  StringUtil(); static String dbc2sbcCase(String src); static String sbc2dbcCase(String src); static String toString(String[] array, String delim); static boolean contains(String[] strings, String string, boolean caseSensitive); static boolean containSubstring(String[] strings, String string, boolean caseSensitive); static int count(String src, String target); static String firstCharToLowerCase(String src); static String firstCharToUpperCase(String src); static String toCurrencyString(String src, Locale locale); static String toCurrencyString(Double src, Locale locale); static String replace(String prefix, String src, String value); static String getReplaceString(String src, String[] values); static String replace(String prefix, String src, String[] values); static String insert(String src, String target, int index); static boolean isEmpty(String str); static boolean isBlank(String str); static boolean isAnyEmpty(String... strings); static boolean isAnyBlank(String... strings); static boolean isAllEmpty(String... strings); static boolean isAllBlank(String... strings); static boolean isAllNotBlank(String... strings); static boolean isAllNotEmpty(String... strings); static boolean isDigitalString(String src); static boolean hasLength(CharSequence src); static boolean hasText(CharSequence str); static String trimAll(String src); static String trimLeading(String str); static String trimTrailing(String str); static String[] split(String str, int num); }
StringUtil { public static int count(String src, String target) { int count = 0; int index = src.indexOf(target); while (index != -1) { count++; index = src.indexOf(target, index + 1); } return count; } private  StringUtil(); static String dbc2sbcCase(String src); static String sbc2dbcCase(String src); static String toString(String[] array, String delim); static boolean contains(String[] strings, String string, boolean caseSensitive); static boolean containSubstring(String[] strings, String string, boolean caseSensitive); static int count(String src, String target); static String firstCharToLowerCase(String src); static String firstCharToUpperCase(String src); static String toCurrencyString(String src, Locale locale); static String toCurrencyString(Double src, Locale locale); static String replace(String prefix, String src, String value); static String getReplaceString(String src, String[] values); static String replace(String prefix, String src, String[] values); static String insert(String src, String target, int index); static boolean isEmpty(String str); static boolean isBlank(String str); static boolean isAnyEmpty(String... strings); static boolean isAnyBlank(String... strings); static boolean isAllEmpty(String... strings); static boolean isAllBlank(String... strings); static boolean isAllNotBlank(String... strings); static boolean isAllNotEmpty(String... strings); static boolean isDigitalString(String src); static boolean hasLength(CharSequence src); static boolean hasText(CharSequence str); static String trimAll(String src); static String trimLeading(String str); static String trimTrailing(String str); static String[] split(String str, int num);  }