Java String Shorten shorten(String script, int length)

Here you can find the source of shorten(String script, int length)

Description

shorten

License

Open Source License

Declaration

public static String shorten(String script, int length) 

Method Source Code

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

public class Main {
    public static String shorten(String script, int length) {
        String shortened = script.length() > length ? script.substring(0, length).intern() + "..." : script;
        return shortened.replace("\n", " ").replace("\r", " ").replace("\t", " ");
    }//w  w  w . j  a  v a 2s . c o m

    public static String shorten(String script) {
        return shorten(script, 100);
    }
}

Related

  1. shorten(String s, int length)
  2. shorten(String s, int length, String suffix)
  3. shorten(String s, int length, String suffix)
  4. shorten(String s, int max)
  5. shorten(String s, int maxLength)
  6. shorten(String str, int length)
  7. shorten(String str, int length)
  8. shorten(String string, boolean isPrefix)
  9. shorten(String string, int size)