Here you can find the source of shorten(String script, int length)
public static String shorten(String script, int length)
//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); } }