Java String Truncate truncate(String value, int length)

Here you can find the source of truncate(String value, int length)

Description

truncate

License

Open Source License

Declaration

public static String truncate(String value, int length) 

Method Source Code

//package com.java2s;

public class Main {
    public static String truncate(String value, int length) {
        if (value != null && value.length() > length) {
            value = value.substring(0, length);
            value += "...";
        }//  w  w  w .  ja v  a  2  s  .  com
        return value;
    }
}

Related

  1. truncate(String url, int offset, int size)
  2. Truncate(String v, int length)
  3. truncate(String val, int maxlen)
  4. truncate(String value, int length)
  5. truncate(String value, int length)
  6. truncate(String value, int length)
  7. truncate(String value, int maxLen, String ellipses)
  8. truncate(String x, int length)
  9. truncateAndTrailOffText(String text, int limit)