@Test public void testCountSlashes() { assertEquals(0, StringUtils.countSlashes("")); assertEquals(0, StringUtils.countSlashes("abcde")); assertEquals(1, StringUtils.countSlashes("/")); assertEquals(1, StringUtils.countSlashes("/test")); assertEquals(1, StringUtils.countSlashes("test/")); assertEquals(1, StringUtils.countSlashes("test/test")); assertEquals(2, StringUtils.countSlashes(" assertEquals(2, StringUtils.countSlashes(" assertEquals(2, StringUtils.countSlashes("test assertEquals(2, StringUtils.countSlashes("/test/")); assertEquals(3, StringUtils.countSlashes("/test/test/")); }
public static int countSlashes(final String s) { int result = 0; for (char ch : s.toCharArray()) { if (ch == '/') { ++result; } } return result; }
StringUtils { public static int countSlashes(final String s) { int result = 0; for (char ch : s.toCharArray()) { if (ch == '/') { ++result; } } return result; } }
StringUtils { public static int countSlashes(final String s) { int result = 0; for (char ch : s.toCharArray()) { if (ch == '/') { ++result; } } return result; }  }
StringUtils { public static int countSlashes(final String s) { int result = 0; for (char ch : s.toCharArray()) { if (ch == '/') { ++result; } } return result; }  static boolean isBlank(String s); static boolean isNotBlank(String s); static boolean hasLeadingSlash(final String s); static boolean hasTrailingSlash(final String s); static String[] splitBySlash(final String s); static int countSlashes(final String s); static String removePathPrefix(String prefix, String url); }
StringUtils { public static int countSlashes(final String s) { int result = 0; for (char ch : s.toCharArray()) { if (ch == '/') { ++result; } } return result; }  static boolean isBlank(String s); static boolean isNotBlank(String s); static boolean hasLeadingSlash(final String s); static boolean hasTrailingSlash(final String s); static String[] splitBySlash(final String s); static int countSlashes(final String s); static String removePathPrefix(String prefix, String url);  }