Java Number Sum summarize(String longString, int limit)

Here you can find the source of summarize(String longString, int limit)

Description

summarize

License

Mozilla Public License

Declaration

public static String summarize(String longString, int limit) 

Method Source Code

//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;
    }
}

Related

  1. sumHash(int leftHash, int rightHash)
  2. sumIf(final Integer number, final Integer sum, final Boolean condition)
  3. sumIsMod10(int sum)
  4. sumLange(int _a, int _b)
  5. sumLogProb(double a, double b)
  6. summarizeCigarString(String cigarString)
  7. summary(String text)
  8. summatory(int value)
  9. sumMinMax(int a, int b)