Home | History | Annotate | Download | only in base

Lines Matching refs:maxLength

552    * sequence is greater than {@code maxLength}, the returned string will be exactly
553 * {@code maxLength} chars in length and will end with the given {@code truncationIndicator}.
578 * @throws IllegalArgumentException if {@code maxLength} is less than the length of
584 public static String truncate(CharSequence seq, int maxLength, String truncationIndicator) {
588 int truncationLength = maxLength - truncationIndicator.length();
590 // in this worst case, this allows a maxLength equal to the length of the truncationIndicator,
593 "maxLength (%s) must be >= length of the truncation indicator (%s)",
594 maxLength, truncationIndicator.length());
596 if (seq.length() <= maxLength) {
598 if (string.length() <= maxLength) {
601 // if the length of the toString() result was > maxLength for some reason, truncate that
605 return new StringBuilder(maxLength)