docs: @SuppressWarnings("null")
  	public static @NonNull String[] split(String s, char delim, boolean all) {
  		List<String> splits = new ArrayList<>();
  		int splitIndex = -1;
  
  		while (true) {
  			int nextSplitIndex = (splitIndex == -1 || all ? s.indexOf(delim, splitIndex + 1) : -1);
  
  			if (nextSplitIndex < 0) {
  				splits.add(s.substring(splitIndex + 1));
  				break;
  			}
  			splits.add(s.substring(splitIndex + 1, nextSplitIndex));
  			splitIndex = nextSplitIndex;
  		}
  		return splits.toArray(new @Nullable String[splits.size()]);
  	}