Java String Truncate truncateByCharLength(String string, int maxLength)

Here you can find the source of truncateByCharLength(String string, int maxLength)

Description

truncate By Char Length

License

Open Source License

Declaration

public static String truncateByCharLength(String string, int maxLength) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String truncateByCharLength(String string, int maxLength) {
        return string.length() > maxLength ? string.substring(0, maxLength) : string;
    }/*from w ww . j  a va 2s . c om*/
}

Related

  1. truncateAt(String str, char chr)
  2. truncateAtMaxLength(String source, int maxLength, boolean addEllipsis)
  3. truncateAtWhitespace(String text, int length)
  4. truncateAtWord(String input, int length)
  5. truncateBodyText(String input)
  6. truncateByCharLengthWithEllipsis(String string, int maxLength)
  7. truncateCellValue(String x, int maxChars)
  8. truncateCodeStringIfNeeded(String codeString)
  9. truncateData(String data, int idLength)