Returned expression results in the string with all trailing chars removed (any char in the characters string).
542591
public static Expression rtrim(String expression, String characters) {
        return rtrim(x(expression), characters);
    }
794189
private String ltrim(final String s) {
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) != ' ') {
				return s.substring(i);
			}
		}
		return s;
	}
699627
private static Node asDetachedExpression(Node expr) {
    switch (expr.getToken()) {
      case SPREAD:
        expr = IR.arraylit(expr.detach()).srcref(expr);
        break;
      default:
        break;
    }

    if (expr.getParent() != null) {
      expr.detach();
    }

    checkState(IR.mayBeExpression(expr), expr);
    return expr;
  }
1314663
public static String shrink(String string, char c) {
		if (string == null) {
			return null;
		}
		string = string.trim();
		Pattern pattern = Pattern.compile("\\" + String.valueOf(c) + "{2,}");
		return pattern.matcher(string).replaceAll(String.valueOf(c));
	}
1331591
public final static String trim(String value)
    {
        String result = null;
        if (null != value)
        {
            result = value.trim();
        }

        return result;
    }
517583
private String takeString() {
        String s = _string.toString();
        // trim trailing whitespace.
        if (s.length() > _length)
            s = s.substring(0, _length);
        _string.reset();
        _length = -1;
        return s;
    }
1096328
public static boolean empty(final String aString) {
		if (aString != null) {
			final int len = aString.length();

			for (int i = 0; i < len; i++) {
				// This mirrors String.trim(), which removes ASCII
				// control characters as well as whitespace.
				if (aString.charAt(i) > ' ') {
					return false;
				}
			}
		}

		return true;
	}
332320
@Deprecated
	public static String removeChars(String S, char ch) {
		int pos;
		while((pos=S.indexOf(ch))!=-1) S=S.substring(0,pos)+S.substring(pos+1);
		return S;
	}
57968
public String trimLeading(String str) {
        if (str == null) {
            return null;
        }

        int length = str.length();
        for (int i=0; i<length; i++) {
            if (str.charAt(i) > ' ') {
                return str.substring(i);
            }
        }

        return "";
    }
252230
static
	public String trim(String string){
		int length = string.length();

		int trimmedLength = length;

		while(trimmedLength > 0){
			char c = string.charAt(trimmedLength - 1);

			if(!Character.isWhitespace(c)){
				break;
			}

			trimmedLength--;
		}

		if(trimmedLength < length){
			string = string.substring(0, trimmedLength);
		}

		return string;
	}
682333
public StringExpression trim() {
        if (trim == null) {
            trim = Expressions.stringOperation(Ops.TRIM, mixin);
        }
        return trim;
    }
821044
@Nonnull
  public static String trimLeft(@Nonnull final String value) {
    final StringBuilder result = new StringBuilder(assertNotNull(value).length());
    int index = 0;
    for(;index<value.length();index++){
      final char chr = value.charAt(index);
      if (!(Character.isWhitespace(chr) || Character.isISOControl(chr))) break;
    }
    if (index<value.length()) {
      result.append(value, index, value.length());
    }
    return result.toString();
  }
558137
public static String stripAccents(final String str) {
        if (N.isNullOrEmpty(str)) {
            return str;
        }

        final String decomposed = Normalizer.normalize(str, Normalizer.Form.NFD);
        // Note that this doesn't correctly remove ligatures...
        return pattern_accent.matcher(decomposed).replaceAll("");//$NON-NLS-1$
    }
672798
@SafeVarargs
    public static char[] removeAll(final char[] a, final char... elements) {
        if (N.isNullOrEmpty(a)) {
            return N.EMPTY_CHAR_ARRAY;
        } else if (N.isNullOrEmpty(elements)) {
            return a.clone();
        } else if (elements.length == 1) {
            return removeAllOccurrences(a, elements[0]);
        }

        final CharList list = CharList.of(a.clone());
        list.removeAll(CharList.of(elements));
        return list.trimToSize().array();
    }
1347151
public static String trim(String string)
  {
    if(string == null) {
      return null;
    }
    int length = string.length();
    int beginIndex = 0;
    for(; beginIndex < length; ++beginIndex) {
      if(!Character.isWhitespace(string.charAt(beginIndex))) break;
    }
    int endIndex = length - 1;
    for(; endIndex >= 0; --endIndex) {
      if(!Character.isWhitespace(string.charAt(endIndex))) break;
    }
    return string.substring(beginIndex, endIndex + 1);
  }
865912
private String extractString(char[] data, int start, int end) {
        // skip leading whitespace and quotes
        while (start < end &&
               (' ' == data[start] || '\t' == data[start] || '"' == data[start])) {
            start++;
        }
        // ignore trailing whitespace and quotes
        while (end >= start &&
               (' ' == data[end] || '\t' == data[end] || '"' == data[end])) {
            end--;
        }
        // check for nothing but whitespace
        if (end < start) {
            return null;
        }
        int len = end - start + 1;
        String rc = Normalizer.normalize(new String(data, start, len), Normalizer.NORMALIZE_LOWER);
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "extractString: [" + rc + "]");
        }
        return rc;
    }
567478
public BooleanExpression endsWith(Expression<String> str) {
        return Expressions.booleanOperation(Ops.ENDS_WITH, mixin, str);
    }