String trimRightChar(String c) { int i = length - 1; for (; i >= 0 && this[i] == c; i--) {} return substring(0, i + 1); }