Convenience method to split a CharSequence (with whitespace as delimiter).
Similar to tokenize, but returns an Array of String instead of a List.

@param self the CharSequence to split
@return String[] result of split
@see #split(String)
@since 1.8.2
321953
public static String[] split(CharSequence self) {
        StringTokenizer st = new StringTokenizer(self.toString());
        String[] strings = new String[st.countTokens()];
        for (int i = 0; i < strings.length; i++) {
            strings[i] = st.nextToken();
        }
        return strings;
    }
703500
public static String denormalize(final CharSequence self) {
        final String s = self.toString();
        // Don't do this in static initializer because we may never be needed.
        // TODO: Put this lineSeparator property somewhere everyone can use it.
        if (lineSeparator == null) {
            final StringWriter sw = new StringWriter(2);
            try {
                // We use BufferedWriter rather than System.getProperty because
                // it has the security manager rigamarole to deal with the possible exception.
                final BufferedWriter bw = new BufferedWriter(sw);
                bw.newLine();
                bw.flush();
                lineSeparator = sw.toString();
            } catch (IOException ioe) {
                // This shouldn't happen, but this is the same default used by
                // BufferedWriter on a security exception.
                lineSeparator = "\n";
            }
        }

        final int len = s.length();

        if (len < 1) {
            return s;
        }

        final StringBuilder sb = new StringBuilder((110 * len) / 100);

        int i = 0;

        while (i < len) {
            final char ch = s.charAt(i++);

            switch (ch) {
                case '\r':
                    sb.append(lineSeparator);

                    // Eat the following LF if any.
                    if ((i < len) && (s.charAt(i) == '\n')) {
                        ++i;
                    }

                    break;

                case '\n':
                    sb.append(lineSeparator);
                    break;

                default:
                    sb.append(ch);
                    break;
            }
         }

        return sb.toString();
    }
452050
def split(string, separator_regexp=None, maxsplit=0):
    
    if not string:
        return []
    if separator_regexp is None:
        separator_regexp = _default_separator()
    if not separator_regexp:
        return string.split()
    return re.split(separator_regexp, string, maxsplit)
78426
public static List<String> split(final CharSequence str, final int size) {
        if (size < 1) {
            throw new IllegalArgumentException("The parameter 'size' can not be zero or less than zero");
        }

        if (N.isNullOrEmpty(str)) {
            return new ArrayList<>();
        }

        return split(str, 0, str.length(), size);
    }
1199809
public static Stream<CharSequence> split(CharSequence seq, RegexMatcher matcher)
    {
        return StreamSupport.stream(new SpliteratorImpl(seq, matcher), false);
    }
543210
private static String[] split(String input) {
        char macroStart = MACRO_START.charAt(0);
        char macroEnd = MACRO_END.charAt(0);

        int startIndex = 0;
        boolean inMacro = false;

        List<String> list = new ArrayList<String>();

        for (int endIndex = 0; endIndex < input.length(); endIndex++) {
            char chr = input.charAt(endIndex);

            if (!inMacro) {
                if (chr == macroStart) {
                    String result = input.substring(startIndex, endIndex);
                    if (result.length() > 0) {
                        list.add(result);
                    }
                    inMacro = true;
                    startIndex = endIndex;
                }
            } else {
                if (chr == macroEnd) {
                    String result = input.substring(startIndex, endIndex + 1);
                    if (result.length() > 0) {
                        list.add(result);
                    }
                    inMacro = false;
                    startIndex = endIndex + 1;
                }
            }
        }

        String result = input.substring(startIndex);
        if (result.length() > 0) {
            list.add(result);
        }

        return list.toArray(new String[list.size()]);
    }
707940
private static String[] splitOnTokens(String text, String oneAnySymbolStr, String noneOrMoreSymbolsStr) {
		if (!hasWildcards(text, ONE_ANY_SYMBOL, NONE_OR_MORE_SYMBOLS)) {
			return new String[] { text };
		}
		List<String> list = new ArrayList<>();
		StringBuilder buffer = new StringBuilder();

		boolean escapeMode = false;
		final int length = text.length();
		for (int i = 0; i < length; i++) {
			final char current = text.charAt(i);
			switch (current) {
				case ESCAPE_CHAR:
					if (escapeMode) {
						buffer.append(current);
					} else {
						escapeMode = true;
					}
					break;
				case ONE_ANY_SYMBOL:
					if (escapeMode) {
						buffer.append(current);
						escapeMode = false;
					} else {
						flushBuffer(buffer, list);
						if (!list.isEmpty() && noneOrMoreSymbolsStr.equals(list.get(list.size() - 1))) {
							list.set(list.size() - 1, oneAnySymbolStr);
							list.add(noneOrMoreSymbolsStr);
						} else {
							list.add(oneAnySymbolStr);
						}
					}
					break;
				case NONE_OR_MORE_SYMBOLS:
					if (escapeMode) {
						buffer.append(current);
						escapeMode = false;
					} else {
						flushBuffer(buffer, list);
						if (list.isEmpty() || !noneOrMoreSymbolsStr.equals(list.get(list.size() - 1))) {
							list.add(noneOrMoreSymbolsStr);
						}
					}
					break;
				default:
					if (escapeMode) {
						buffer.append(ESCAPE_CHAR);
						escapeMode = false;
					}
					buffer.append(current);
			}
		}
		if (escapeMode) {
			buffer.append(ESCAPE_CHAR);
		}
		if (buffer.length() != 0) {
			list.add(buffer.toString());
		}

		return list.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
	}
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;
	}
1049202
protected List<EquPart> tokenize() throws Exception
    {
        /*
         * break apart obvious tokens, realizing that some may need further
         * breakage and some may need to be merged back again
         */
        final List<EquPart> tokens = new ArrayList<>();
        Token token = null;
        char c;
        int level = 0;

        for (int a = 0; a < equ.length(); a++)
        {
            c = equ.charAt(a);
            final boolean isWhitespace = Character.isWhitespace(c);

            if (isWhitespace)
                if (!(token != null && token instanceof TokLiteral && token.accepts(c)))
                {
                    /*
                     * spaces are allowed inside of literals
                     */
                    if (token != null)
                        token.addTo(tokens);
                    token = null;
                    continue;
                }

            if (c == '(')
                level++;

            if (c == ')')
                level--;

            if (token != null && token.accepts(c))
                token.put(c);
            else
            {

                if (token != null)
                    token.addTo(tokens);

                token = Token.instanceFor(c);
                token.setLevel(level);
                token.put(c);
            }
        }

        if (token != null)
            token.addTo(tokens);

        return tokens;
    }
190488
private static List<CharSequence> splitHeader(CharSequence header) {
        final StringBuilder builder = new StringBuilder(header.length());
        final List<CharSequence> protocols = new ArrayList<CharSequence>(4);
        for (int i = 0; i < header.length(); ++i) {
            char c = header.charAt(i);
            if (Character.isWhitespace(c)) {
                // Don't include any whitespace.
                continue;
            }
            if (c == ',') {
                // Add the string and reset the builder for the next protocol.
                protocols.add(builder.toString());
                builder.setLength(0);
            } else {
                builder.append(c);
            }
        }

        // Add the last protocol
        if (builder.length() > 0) {
            protocols.add(builder.toString());
        }

        return protocols;
    }
49283
public static List<String> splitAtLastBlank(String s, int width) {
    List<String> chunks = new ArrayList<>();

    String tmp = s;
    while(tmp.length() > 0) {
      int index = findSplitpoint(tmp, width);
      // store first part
      chunks.add(tmp.substring(0, index));
      // skip whitespace at beginning of line
      while(index < tmp.length() && tmp.charAt(index) == ' ') {
        index += 1;
      }
      // remove a newline
      if(index < tmp.length() && tmp.regionMatches(index, NEWLINE, 0, NEWLINE.length())) {
        index += NEWLINE.length();
      }
      if(index >= tmp.length()) {
        break;
      }
      tmp = tmp.substring(index);
    }

    return chunks;
  }
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");
          }
        };
      }
    };
  }
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()]);
  }
88171
public static List<String> splitString(String line, char delim) {
		return splitString(line, 0, line.length(), delim, new ArrayList<String>());
	}
1188603
public static <S extends CharSequence> String hex(S s, int width, S separator) {
        return hex(s, width, separator, true, new StringBuilder()).toString();
    }
755516
public static String unexpandLine(CharSequence self, int tabStop) {
        StringBuilder builder = new StringBuilder(self.toString());
        int index = 0;
        while (index + tabStop < builder.length()) {
            // cut original string in tabstop-length pieces
            String piece = builder.substring(index, index + tabStop);
            // count trailing whitespace characters
            int count = 0;
            while ((count < tabStop) && (Character.isWhitespace(piece.charAt(tabStop - (count + 1)))))
                count++;
            // replace if whitespace was found
            if (count > 0) {
                piece = piece.substring(0, tabStop - count) + '\t';
                builder.replace(index, index + tabStop, piece);
                index = index + tabStop - (count - 1);
            } else
                index = index + tabStop;
        }
        return builder.toString();
    }
1024992
@SuppressWarnings("unchecked")
    public static List<String> tokenize(CharSequence self) {
        return InvokerHelper.asList(new StringTokenizer(self.toString()));
    }