/** * Trims <js>'/'</js> characters from the end of the specified string. * * @param s The string to trim. * @return A new trimmed string, or the same string if no trimming was necessary. */ public static String trimTrailingSlashes(String s) { if (s == null) return null; while (endsWith(s, '/')) s = s.substring(0, s.length()-1); return s; }
/** * Trims <js>'/'</js> characters from the end of the specified string. * * @param s The string to trim. * @return A new trimmed string, or the same string if no trimming was necessary. */ public static String trimTrailingSlashes(String s) { if (s == null) return null; while (endsWith(s, '/')) s = s.substring(0, s.length()-1); return s; }
/** * Trims <js>'/'</js> characters from the end of the specified string. * * @param s The string to trim. * @return A new trimmed string, or the same string if no trimming was necessary. */ public static String trimTrailingSlashes(String s) { if (s == null) return null; while (StringUtils.endsWith(s, '/')) s = s.substring(0, s.length()-1); return s; }
/** * Trims <js>'/'</js> characters from the end of the specified string. * * @param s The string to trim. * @return A new trimmed string, or the same string if no trimming was necessary. */ public static String trimTrailingSlashes(String s) { if (s == null) return null; while (endsWith(s, '/')) s = s.substring(0, s.length()-1); return s; }
/** * Trims <js>'/'</js> characters from both the start and end of the specified string. * * @param s The string to trim. * @return A new trimmed string, or the same string if no trimming was necessary. */ public static String trimSlashes(String s) { if (s == null) return null; while (endsWith(s, '/')) s = s.substring(0, s.length()-1); while (s.length() > 0 && s.charAt(0) == '/') s = s.substring(1); return s; }
/** * Trims <js>'/'</js> characters from both the start and end of the specified string. * * @param s The string to trim. * @return A new trimmed string, or the same string if no trimming was necessary. */ public static String trimSlashes(String s) { if (s == null) return null; while (endsWith(s, '/')) s = s.substring(0, s.length()-1); while (s.length() > 0 && s.charAt(0) == '/') s = s.substring(1); return s; }
/** * Trims <js>'/'</js> characters from both the start and end of the specified string. * * @param s The string to trim. * @return A new trimmed string, or the same string if no trimming was necessary. */ public static String trimSlashes(String s) { if (s == null) return null; while (endsWith(s, '/')) s = s.substring(0, s.length()-1); while (s.length() > 0 && s.charAt(0) == '/') s = s.substring(1); return s; }
/** * Trims <js>'/'</js> characters from both the start and end of the specified string. * * @param s The string to trim. * @return A new trimmed string, or the same string if no trimming was necessary. */ public static String trimSlashes(String s) { if (s == null) return null; while (StringUtils.endsWith(s, '/')) s = s.substring(0, s.length()-1); while (s.length() > 0 && s.charAt(0) == '/') s = s.substring(1); return s; }
/** * Specifies the sort arguments. * * <p> * Column names can be suffixed with <js>'+'</js> or <js>'-'</js> to indicate ascending or descending order. * <br>No suffix implies ascending order. * * <p> * Note that the order of the sort is important. * * @param sortArgs * The columns to sort by. * Can be <jk>null</jk>. * @return This object (for method chaining). */ public Builder sort(Collection<String> sortArgs) { for (String s : sortArgs) { boolean isDesc = false; if (endsWith(s, '-', '+')) { isDesc = endsWith(s, '-'); s = s.substring(0, s.length()-1); } this.sort.put(s, isDesc); } return this; }
/** * Specifies the sort arguments. * * <p> * Column names can be suffixed with <js>'+'</js> or <js>'-'</js> to indicate ascending or descending order. * <br>No suffix implies ascending order. * * <p> * Note that the order of the sort is important. * * @param sortArgs * The columns to sort by. * Can be <jk>null</jk>. * @return This object (for method chaining). */ public Builder sort(Collection<String> sortArgs) { for (String s : sortArgs) { boolean isDesc = false; if (endsWith(s, '-', '+')) { isDesc = endsWith(s, '-'); s = s.substring(0, s.length()-1); } this.sort.put(s, isDesc); } return this; }
/** * Specifies the sort arguments. * * <p> * Column names can be suffixed with <js>'+'</js> or <js>'-'</js> to indicate ascending or descending order. * <br>No suffix implies ascending order. * * <p> * Note that the order of the sort is important. * * @param sortArgs * The columns to sort by. * Can be <jk>null</jk>. * @return This object (for method chaining). */ public Builder sort(Collection<String> sortArgs) { for (String s : sortArgs) { boolean isDesc = false; if (endsWith(s, '-', '+')) { isDesc = endsWith(s, '-'); s = s.substring(0, s.length()-1); } this.sort.put(s, isDesc); } return this; }
while (StringUtils.endsWith(uri, '/')) uri = uri.substring(0, uri.length()-1); int i = uri.lastIndexOf('/');