Java String Abbreviate abbreviate(final String str, final int maxWidth)

Here you can find the source of abbreviate(final String str, final int maxWidth)

Description

abbreviate

License

Open Source License

Declaration

public static String abbreviate(final String str, final int maxWidth) 

Method Source Code

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

public class Main {
    public static String abbreviate(final String str, final int maxWidth) {
        return str != null && str.length() > maxWidth ? str.substring(0, maxWidth - 3) + "..." : str;
    }/*ww  w.j a va 2 s.  c  o m*/
}

Related

  1. abbr(String str, int length)
  2. abbrev(String longString, int size)
  3. abbrev(String result, int maxLength, String separator)
  4. abbreviate(final String str)
  5. abbreviate(final String str, int lower, int upper, final String appendToEnd)
  6. abbreviate(final String value, final int maxLength)
  7. abbreviate(final String value, int max)
  8. abbreviate(String _str, int _length)