Here you can find the source of summarize(String longString, int limit)
public static String summarize(String longString, int limit)
//package com.java2s; /**/*from w w w . jav a 2s . co m*/ * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This Source Code Form is "Incompatible With Secondary Licenses", as * defined by the Mozilla Public License, v. 2.0. */ public class Main { public static String summarize(String longString, int limit) { String s = longString; if (s.indexOf("<p>") > -1) s = s.substring(0, s.indexOf("<p>")); if (s.indexOf("\n") > -1) s = s.substring(0, s.indexOf("\n")); return s.length() > limit ? s.substring(0, limit) + "..." : s; } }