Formats the String collection with the specified separator.

@param d the String collection to format
@param sep separator between the single values of the array, e.g. ' '
@return a String representing the String Collection d
492194
public static String format(Collection<String> d, String sep) {
    if(d == null) {
      return "null";
    }
    if(d.isEmpty()) {
      return "";
    }
    if(d.size() == 1) {
      return d.iterator().next();
    }
    int len = sep.length() * (d.size() - 1);
    for(String s : d) {
      len += s.length();
    }
    Iterator<String> it = d.iterator();
    StringBuilder buffer = new StringBuilder(len) //
        .append(it.next());
    while(it.hasNext()) {
      buffer.append(sep).append(it.next());
    }
    return buffer.toString();
  }
1328330
public static List<String> split(String s, String separator) {
        if (s == null) return null;
        List<String> rslt = null;
        if (s.isEmpty() || isEmpty(separator)) {
            rslt = new ArrayList<>(1);
            rslt.add(s);
            return rslt;
        }

        //return s.split(COMMA_SPLIT); - NOT WORKING when compiled to JS

        int start = 0;
        int p = start;
        do {
            int j = s.indexOf(separator, p);
            if (j == -1) {
                if (rslt == null) {
                    rslt = new ArrayList<>(1);
                    rslt.add(s);
                    return rslt;
                }
                rslt.add(s.substring(start));
                break;
            }
            if (j > 0 && s.charAt(j - 1) == '\\') {
                p = j + 1;
                continue;
            } else {
                if (rslt == null) rslt = new ArrayList<String>();
                rslt.add(s.substring(start, j));
                start = j + 1;
                p = start;
            }

        } while (true);

        return rslt;
    }
887885
public static String sepList(String sep, Iterable<?> os, int max) {
		return sepList(sep, null, os, max);
	}
753177
public String getDelimited(String[] outTemplate, String separator) {
        StringBuilder b = new StringBuilder(1024);

        for (String var : outTemplate) {
            if (b.length() > 0) {
                b.append(separator);
            }
            b.append(getDataMap().get(var));
        }

        return b.toString();
    }
371212
public static <T> String join(final Collection<T> collection, final String separator) {

        if (isEmpty(collection)) {
            return "";
        }
        StringBuffer stringBuffer = new StringBuffer();
        boolean isFirstVisited = true;
        for (Object object : collection) {
            if (isFirstVisited) {
                isFirstVisited = false;
            } else {
                stringBuffer.append(separator);
            }
            stringBuffer.append(ObjectUtils.toString(object));
        }
        return stringBuffer.toString();
    }
535439
public static String joinWithInnerSeparator(String separator,
                                                Object... collection) {
        StringBuilder b = new StringBuilder();
        boolean first = true;

        for (Object o : collection) {
            if (first) {
                first = false;
            } else {
                b.append(separator);
            }
            b.append(o.toString());
            b.append(separator);
        }
        return b.toString();
    }
398765
private String commaSeparate(Collection<String> strings)
    {
        StringBuilder buffer = new StringBuilder();
        Iterator<String> iterator = strings.iterator();
        while (iterator.hasNext())
        {
            String string = iterator.next();
            buffer.append(string);
            if (iterator.hasNext())
            {
                buffer.append(", ");
            }
        }
        return buffer.toString();
    }
190574
public static String join(Collection<?> collection, String separator)
  {
    return StringUtils.join(collection, separator);
  }
865644
public static String[] split(String str, String separator){
    
    	return Pattern.compile(separator).split(str, -1);
    }
948387
public static function format($string, $format, $separator = '/')
	{
		// Trim
		$string = trim($string, $separator);
		
		// Empty path case
		if ($string === '') {
			if ($format == self::FORMAT_BOTH_DELIMITERS) {
				return $separator;
			} else {
				return $string;
			}
		}
		
		// Add delimiters
		if ($format & self::FORMAT_LEFT_DELIMITER) {
			$string = $separator . $string;
		}
		if ($format & self::FORMAT_RIGHT_DELIMITER) {
			$string = $string . $separator;
		}
		
		return $string;
	}
377154
public static String toSeparatedString(List<?> values, String separator) {
    	return toSeparatedString(values, separator, null);
    }
287501
protected String concat(Set<String> set, String sep)
	{
		String s = "";

		int i = set.size();
		for (String ss : set)
		{
			s += ss;
			if (--i > 0) s += sep;
		}
		return s;
	}
1100225
public static String formatTimeDelta(long time, CharSequence sep) {
    final StringBuilder sb = new StringBuilder();
    final Formatter fmt = new Formatter(sb);

    for(int i = TIME_UNIT_SIZES.length - 1; i >= 0; --i) {
      // We do not include ms if we are in the order of minutes.
      if(i == 0 && sb.length() > 4) {
        continue;
      }
      // Separator
      if(sb.length() > 0) {
        sb.append(sep);
      }
      final long acValue = time / TIME_UNIT_SIZES[i];
      time = time % TIME_UNIT_SIZES[i];
      if(!(acValue == 0 && sb.length() == 0)) {
        fmt.format("%0" + TIME_UNIT_DIGITS[i] + "d%s", Long.valueOf(acValue), TIME_UNIT_NAMES[i]);
      }
    }
    fmt.close();
    return sb.toString();
  }
756362
def partition(string, sep):
    
    p = string.split(sep, 1)
    if len(p) == 2:
        return p[0], sep, p[1]
    return string, '', ''
755104
public static String mkString(@javax.annotation.Nonnull final String separator, final String... strs) {
    return Arrays.asList(strs).stream().collect(Collectors.joining(separator));
  }
985146
public static String join(String[] strings, String separator) {
        if (strings == null || strings.length == 0) {
            return EMPTY;
        }
        StringBuilder sb = new StringBuilder();
        for (String string : strings) {
            if (isNotBlank(string)) {
                sb.append(string).append(separator);
            }
        }
        return sb.length() > 0 ? sb.substring(0, sb.length() - separator.length()) : StringUtils.EMPTY;
    }
367997
private void drawSeparator(Separator sep)
    {
        final Color color = sep.isHorizontal() ? Color.BLUE : Color.RED;
        browser.getOutputDisplay().drawRectangle(sep, color);
    }