Java String Truncate truncateShortMessage(final String message)

Here you can find the source of truncateShortMessage(final String message)

Description

truncate Short Message

License

Apache License

Declaration

public static String truncateShortMessage(final String message) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    static final int MAX_SHORT_MESSAGE_LENGTH = 250;

    public static String truncateShortMessage(final String message) {
        if (null == message) {
            return "";
        } else if (message.length() > MAX_SHORT_MESSAGE_LENGTH) {
            return message.substring(0, MAX_SHORT_MESSAGE_LENGTH);
        } else {/*from  w  ww.  j av a 2  s.co  m*/
            return message;
        }
    }
}

Related

  1. truncateOnSpace(String text, Integer length)
  2. truncateOrPadString(String str)
  3. truncatePrefixFromPath(String fileName)
  4. truncatePunctuation(String authority)
  5. truncateSentence(String input, int length)
  6. truncateStr(String str, int maxNumChars)
  7. truncateString(final String str, final int iMaxLength)
  8. truncateString(int length, String srcString)
  9. truncateString(String description, int length)