Java String Truncate truncateMessage(String message, int TRUNCATED_MSG_SIZE)

Here you can find the source of truncateMessage(String message, int TRUNCATED_MSG_SIZE)

Description

truncate Message

License

Open Source License

Declaration

public static String truncateMessage(String message, int TRUNCATED_MSG_SIZE) 

Method Source Code

//package com.java2s;
/**//from   w w w . j av a  2  s.  co m
* License: https://github.com/votingsystem/votingsystem/wiki/Licencia
*/

public class Main {
    public static String truncateMessage(String message, int TRUNCATED_MSG_SIZE) {
        if (message != null && message.length() > TRUNCATED_MSG_SIZE)
            return message.substring(0, TRUNCATED_MSG_SIZE) + "...";
        else
            return message;
    }
}

Related

  1. truncateJavaBeanMethodName(String methodName, int prefixLength)
  2. truncateLabel(String label)
  3. truncateLeadingSlash(String uri)
  4. truncateLongName(String name, int nameLength)
  5. truncateLongStr(String str)
  6. truncateMessageIn50000Characters(final String message)
  7. truncateName(String name)
  8. truncateName(String name)
  9. truncateNicely(String s, int n, String suffix)