Java String Clip clipText(String text, int maxLength)

Here you can find the source of clipText(String text, int maxLength)

Description

clip Text

License

Open Source License

Declaration

public static String clipText(String text, int maxLength) 

Method Source Code

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

public class Main {
    public static String clipText(String text, int maxLength) {
        if (text.length() <= maxLength) {
            return text;
        } else {/*from www  .j  a  va  2  s.c  o  m*/
            return text.substring(0, maxLength) + "...";
        }
    }
}

Related

  1. clip(final String s, final int leftClip, final int rightClip)
  2. clip(String characterItem)
  3. clip(String str, int startChars)
  4. ClipObjectReferenceAddress(String p_fullObjectReference)
  5. clipString(String input, int numChars, boolean appendEllipses)