把str按splitRegexp进行拆分后，用join作为连接拼接在一起
161763
public static String canonicalize(String str, String splitRegexp,
			String join, boolean trim, boolean excludeEmpty,
			boolean capitalizeWord) {
		if (str == null)
			return null;

		return join(str.split(splitRegexp), join, trim, excludeEmpty,
				capitalizeWord);
	}
652330
public static List<String> split(String str, char separator, int limit, boolean isTrim, boolean ignoreEmpty){
		return split(str, separator, limit, isTrim, ignoreEmpty, false);
	}
544882
public static List<String> split(@Nullable final String str, final char separatorChar, int expectParts) {
		if (str == null) {
			return null;
		}

		final int len = str.length();
		if (len == 0) {
			return ListUtil.emptyList();
		}

		final List<String> list = new ArrayList<String>(expectParts);
		int i = 0;
		int start = 0;
		boolean match = false;
		while (i < len) {
			if (str.charAt(i) == separatorChar) {
				if (match) {
					list.add(str.substring(start, i));
					match = false;
				}
				start = ++i;
				continue;
			}
			match = true;
			i++;
		}
		if (match) {
			list.add(str.substring(start, i));
		}
		return list;
	}
1067101
public static String join(String delimiter, Object... values) {
        // Since primitive arrays does not pass as a values array, but as it's
        // single first element.
        if (values.length == 1) {
            Class<?> type = values[0].getClass();
            if (char[].class.equals(type)) {
                return joinP(delimiter, (char[]) values[0]);
            } else if (int[].class.equals(type)) {
                return joinP(delimiter, (int[]) values[0]);
            } else if (long[].class.equals(type)) {
                return joinP(delimiter, (long[]) values[0]);
            } else if (double[].class.equals(type)) {
                return joinP(delimiter, (double[]) values[0]);
            } else if (boolean[].class.equals(type)) {
                return joinP(delimiter, (boolean[]) values[0]);
            }
        }

        StringBuilder builder = new StringBuilder();
        boolean first = true;
        for (Object value : values) {
            if (first) {
                first = false;
            } else {
                builder.append(delimiter);
            }
            builder.append(Objects.toString(value));
        }

        return builder.toString();
    }
1205378
function split(str, separator) {
    separator = separator || '';
    if (_.isString(str)) {
        return str.split(separator);
    } else {
        return str;
    }
}
471211
void readRegExp(int startToken)
        throws IOException
    {
        int start = tokenBeg;
        stringBufferTop = 0;
        if (startToken == Token.ASSIGN_DIV) {
            // Miss-scanned /=
            addToString('=');
        } else {
            if (startToken != Token.DIV) Kit.codeBug();
        }

        boolean inCharSet = false; // true if inside a '['..']' pair
        int c;
        while ((c = getChar()) != '/' || inCharSet) {
            if (c == '\n' || c == EOF_CHAR) {
                ungetChar(c);
                tokenEnd = cursor - 1;
                this.string = new String(stringBuffer, 0, stringBufferTop);
                parser.reportError("msg.unterminated.re.lit");
                return;
            }
            if (c == '\\') {
                addToString(c);
                c = getChar();
            } else if (c == '[') {
                inCharSet = true;
            } else if (c == ']') {
                inCharSet = false;
            }
            addToString(c);
        }
        int reEnd = stringBufferTop;

        while (true) {
            if (matchChar('g'))
                addToString('g');
            else if (matchChar('i'))
                addToString('i');
            else if (matchChar('m'))
                addToString('m');
            else if (matchChar('y'))  // FireFox 3
                addToString('y');
            else
                break;
        }
        tokenEnd = start + stringBufferTop + 2;  // include slashes

        if (isAlpha(peekChar())) {
            parser.reportError("msg.invalid.re.flag");
        }

        this.string = new String(stringBuffer, 0, reEnd);
        this.regExpFlags = new String(stringBuffer, reEnd,
                                      stringBufferTop - reEnd);
    }
753515
def rejoin(string, separator_regexp=None, spaced=False):
    
    strings = split_and_strip(string)
    if separator_regexp is None:
        separator_regexp = _default_separator()
    joiner = spaced and '%s ' % separator_regexp or separator_regexp
    return joiner.join(strings)
1137115
public static String join(String _delimiter, List<String> _strings) {
        if (_strings == null) {
            return null;
        }
        if (_delimiter == null) {
            _delimiter = "";
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < _strings.size(); i++) {
            sb.append(_strings.get(i));
            if (i < _strings.size() - 1) { // only append delimiter if this is not the last token
                sb.append(_delimiter);
            }
        }
        return sb.toString();
    }
1115447
private static String join(double[] seriesData, String separator) {

    // two or more elements
    StringBuilder sb = new StringBuilder(256); // Java default is 16, probably too small
    sb.append(seriesData[0]);
    for (int i = 1; i < seriesData.length; i++) {

      if (separator != null) {
        sb.append(separator);
      }

      sb.append(seriesData[i]);
    }
    return sb.toString();
  }
999399
public static String[] split(String str, char separator) {
    final int len;
    if (str == null 
        || ((len = str.length()) == 0)) {
      return null;
    }

    List<String> componentList = new ArrayList<String>();
    int startIndex = 0;

    for (int i = 0; i < len; i++) {
      if (str.charAt(i) == separator) {
        componentList.add(str.substring(startIndex, i));
        startIndex = i + 1;
      }
    }

    if (str.charAt(len - 1) != separator) {
      componentList.add(str.substring(startIndex, len));
    }

    return componentList.toArray(new String[componentList.size()]);
  }
93648
function splitNext(source, cb, rules) { 
  
  var matchPos = source.search( makeRegExp( joinProperties( rules ) ) );
  if (matchPos != -1) {
    var match = source.substr( 0, matchPos + 1 )
    for (property in rules) {
      var rule = rules[property]
        , re = makeRegExp( rule );
      if (source.search(re) == matchPos) {
        var token = source.match( re )
          , response = {
              lhs: source.substr( 0, matchPos ), 
              rhs: source.substr( matchPos + token[0].length ),
              token: token[0]
            };
        cb( property, response );
        return;
      }
    }
  }
  cb( 'end', { lhs: source } );
  
  function makeRegExp( rules ) {
    return new RegExp( '(' + rules + ')' ); 
  }

  function joinProperties(properties) {
    var result = [];
    for(property in properties) {
      result.push( properties[property] );
    }
    return result.join( '|' );
  }
}
1352828
private static void checkRegexp(String regexp) {
        String checking = regexp.replaceAll("\\\\\\(", "X").replaceAll("\\(\\?", "X");
        int checked = checking.indexOf('(');
        if (checked > -1) {
            String msg = "Only non-capturing groups allowed:\r\n" +
                         regexp + "\r\n";
            for (int i = 0; i < checked; i++) {
                msg += " ";
            }
            msg += "^";
            throw new IllegalArgumentException(msg);
        }
    }
247795
@SuppressWarnings("rawtypes")
    public static String join(final Collection<?> col, final String separator,
            final boolean ignoreEmptyElement, final boolean trim, final ElementConverter elementConverter) {

        final List<Object> list = new ArrayList<Object>();
        for(Object element : col) {
            if(element == null) {
                continue;
            }

            Object value = element;

            if(element instanceof String) {
                String str = (String) element;
                if(ignoreEmptyElement && isEmpty(str)) {
                    continue;

                } else if(trim) {
                    value = str.trim();
                }

            } else if(element instanceof Character && isEmpty(element.toString())) {
                String str = element.toString();
                if(ignoreEmptyElement && isEmpty(str)) {
                    continue;

                } else if(trim) {
                    value = str.trim().charAt(0);
                }

            } else if(char.class.isAssignableFrom(element.getClass())) {
                String str = element.toString();
                if(ignoreEmptyElement && isEmpty(str)) {
                    continue;

                } else if(trim) {
                    value = str.trim().charAt(0);
                }
            }

            list.add(value);

        }

        return join(list, separator, elementConverter);

    }
559570
private static List<String> split(String str, char delim) {

    List<String> result = Lists.newArrayList();

    int currPartStart = 0;
    while (true) {
      int currPartEnd = str.indexOf(delim, currPartStart);
      if (currPartEnd == -1) {
        result.add(str.substring(currPartStart));
        break;
      } else {
        result.add(str.substring(currPartStart, currPartEnd));
        currPartStart = currPartEnd + 1;
      }
    }

    return result;
  }
1026219
public static String join(String delimiter, String[] arr) {
    return join(delimiter, Arrays.asList(arr));
  }
724660
function asRegExps(array) {
    var array = asArray(array), len = array.length;
    for (var i = 0; i < len; i++) {
        if (!(array[i] instanceof RegExp)) {
            array[i] = new RegExp(array[i]);
        }
    }
    return array;
}
131157
private static Iterable<String> splitAndOmitEmpty(final String str, final char splitChar) {
    return new Iterable<String>() {
      @Override
      public Iterator<String> iterator() {
        return new Iterator<String>() {

          int startIdx = 0;
          String next = null;

          @Override
          public boolean hasNext() {
            while (next == null && startIdx < str.length()) {
              int idx = str.indexOf(splitChar, startIdx);
              if (idx == startIdx) {
                // Omit empty string
                startIdx++;
                continue;
              }
              if (idx >= 0) {
                // Found the next part
                next = str.substring(startIdx, idx);
                startIdx = idx;
              } else {
                // The last part
                if (startIdx < str.length()) {
                  next = str.substring(startIdx);
                  startIdx = str.length();
                }
                break;
              }
            }
            return next != null;
          }

          @Override
          public String next() {
            if (hasNext()) {
              String next = this.next;
              this.next = null;
              return next;
            }
            throw new NoSuchElementException("No more element");
          }

          @Override
          public void remove() {
            throw new UnsupportedOperationException("Remove not supported");
          }
        };
      }
    };
  }