@Test void join() { assertNull(StringUtils.join(null, 0, 0, DELIM)); assertEquals("", StringUtils.join(StringUtils.EMPTY_STRINGS, 0, 0, DELIM)); assertEquals("A", StringUtils.join(ONE, 0, 1, DELIM)); assertEquals(JOINED, StringUtils.join(ARRAY, 0, ARRAY.length, DELIM)); }
public static String join(String[] ss, int off, int len, char delim) { if (ss == null) return null; if (len == 0) return ""; if (len == 1) return Objects.requireNonNullElse(ss[off], ""); StringBuilder sb = new StringBuilder(Objects.requireNonNullElse(ss[off], "")); for (int i = off + 1; i < len; i++) sb.append(delim).append(Objects.requireNonNullElse(ss[i], "")); return sb.toString(); }
StringUtils { public static String join(String[] ss, int off, int len, char delim) { if (ss == null) return null; if (len == 0) return ""; if (len == 1) return Objects.requireNonNullElse(ss[off], ""); StringBuilder sb = new StringBuilder(Objects.requireNonNullElse(ss[off], "")); for (int i = off + 1; i < len; i++) sb.append(delim).append(Objects.requireNonNullElse(ss[i], "")); return sb.toString(); } }
StringUtils { public static String join(String[] ss, int off, int len, char delim) { if (ss == null) return null; if (len == 0) return ""; if (len == 1) return Objects.requireNonNullElse(ss[off], ""); StringBuilder sb = new StringBuilder(Objects.requireNonNullElse(ss[off], "")); for (int i = off + 1; i < len; i++) sb.append(delim).append(Objects.requireNonNullElse(ss[i], "")); return sb.toString(); }  }
StringUtils { public static String join(String[] ss, int off, int len, char delim) { if (ss == null) return null; if (len == 0) return ""; if (len == 1) return Objects.requireNonNullElse(ss[off], ""); StringBuilder sb = new StringBuilder(Objects.requireNonNullElse(ss[off], "")); for (int i = off + 1; i < len; i++) sb.append(delim).append(Objects.requireNonNullElse(ss[i], "")); return sb.toString(); }  static String trim(String s, Trim trim); static String requireNonEmpty(String s); static String requireNonBlank(String s); static Optional<String> optionalOf(String s); static String cut(String s, int length, char delim, int index); static String cut(String s, int length, char delim, int index, Trim trim); static String[] split(String s, char delim); static String[] split(String s, int length, char delim); static String[] split(String s, int length, char delim, Trim trim); static String join(String[] ss, int off, int len, char delim); static String trimDS(String s); static String trimAndNullifyEmpty(String s); }
StringUtils { public static String join(String[] ss, int off, int len, char delim) { if (ss == null) return null; if (len == 0) return ""; if (len == 1) return Objects.requireNonNullElse(ss[off], ""); StringBuilder sb = new StringBuilder(Objects.requireNonNullElse(ss[off], "")); for (int i = off + 1; i < len; i++) sb.append(delim).append(Objects.requireNonNullElse(ss[i], "")); return sb.toString(); }  static String trim(String s, Trim trim); static String requireNonEmpty(String s); static String requireNonBlank(String s); static Optional<String> optionalOf(String s); static String cut(String s, int length, char delim, int index); static String cut(String s, int length, char delim, int index, Trim trim); static String[] split(String s, char delim); static String[] split(String s, int length, char delim); static String[] split(String s, int length, char delim, Trim trim); static String join(String[] ss, int off, int len, char delim); static String trimDS(String s); static String trimAndNullifyEmpty(String s); static final String[] EMPTY_STRINGS; }