@Test public void trims_slashes() { assertThat(trimTrailingSlash("/")).isEqualTo(""); assertThat(trimTrailingSlash("/something")).isEqualTo("/something"); assertThat(trimTrailingSlash("/something/")).isEqualTo("/something"); }
public static String trimTrailingSlash(String path) { if (path.endsWith("/")) { return path.substring(0, path.length() - 1); } else { return path; } }
PathUtils { public static String trimTrailingSlash(String path) { if (path.endsWith("/")) { return path.substring(0, path.length() - 1); } else { return path; } } }
PathUtils { public static String trimTrailingSlash(String path) { if (path.endsWith("/")) { return path.substring(0, path.length() - 1); } else { return path; } } private  PathUtils(); }
PathUtils { public static String trimTrailingSlash(String path) { if (path.endsWith("/")) { return path.substring(0, path.length() - 1); } else { return path; } } private  PathUtils(); static boolean isVariable(String fragment); static boolean checkPath(String path, Predicate<String> segmentChecker); static boolean isSpinalCase(String fragment); static boolean isResourcePath(String path); static String terminalSegment(String path); static String trimTrailingSlash(String path); }
PathUtils { public static String trimTrailingSlash(String path) { if (path.endsWith("/")) { return path.substring(0, path.length() - 1); } else { return path; } } private  PathUtils(); static boolean isVariable(String fragment); static boolean checkPath(String path, Predicate<String> segmentChecker); static boolean isSpinalCase(String fragment); static boolean isResourcePath(String path); static String terminalSegment(String path); static String trimTrailingSlash(String path); static final Pattern SPINAL_CASE_PATTERN; }