docs: public static String trim(String list, String delimiter, int[] removeInfo, boolean multiCharacterDelimiter) {
  	if (list.length() == 0) return "";
  
  	if (multiCharacterDelimiter && delimiter.length() > 1) {
  	    int from = 0;
  
  	    // remove at start
  	    while (list.length() >= from + delimiter.length()) {
  		if (list.indexOf(delimiter, from) == from) {
  		    from += delimiter.length();
  		    removeInfo[0]++;
  		    continue;
  		}
  		break;
  	    }
  
  	    if (from > 0) list = list.substring(from);
  
  	    // remove at end
  	    while (list.length() >= delimiter.length()) {
  		if (list.lastIndexOf(delimiter) == list.length() - delimiter.length()) {
  		    removeInfo[1]++;
  		    list = list.substring(0, list.length() - delimiter.length());
  		    continue;
  		}
  		break;
  	    }
  	    return list;
  	}
  
  	if (list.length() == 0) return "";
  	int from = 0;
  	int to = list.length();
  	// int len=delimiter.length();
  	char[] del = delimiter.toCharArray();
  	char c;
  
  	// remove at start
  	outer: while (list.length() > from) {
  	    c = list.charAt(from);
  	    for (int i = 0; i < del.length; i++) {
  		if (c == del[i]) {
  		    from++;
  		    removeInfo[0]++;
  		    // list=list.substring(from);
  		    continue outer;
  		}
  	    }
  	    break;
  	}
  
  	// int len;
  	outer: while (to > from) {
  	    c = list.charAt(to - 1);
  	    for (int i = 0; i < del.length; i++) {
  		if (c == del[i]) {
  		    to--;
  		    removeInfo[1]++;
  		    continue outer;
  		}
  	    }
  	    break;
  	}
  	int newLen = to - from;
  
  	if (newLen < list.length()) {
  	    return list.substring(from, to);
  	}
  	return list;
  
      }