no.sesat.search.result
Class StringChopper

java.lang.Object
  extended by no.sesat.search.result.StringChopper

public class StringChopper
extends Object


Constructor Summary
StringChopper()
           
 
Method Summary
static String chop(String input, int length)
          Truncate s to the given length at closest space or xml tag.
static String chop(String input, int length, boolean chop)
          Truncate s to the given length or to closest space/tag depending on chop.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringChopper

public StringChopper()
Method Detail

chop

public static String chop(String input,
                          int length)
Truncate s to the given length at closest space or xml tag. Any xml tags will be closed/balanced.

Parameters:
input - The string that should be truncated.
length -
Returns:
The truncated string

chop

public static String chop(String input,
                          int length,
                          boolean chop)
Truncate s to the given length or to closest space/tag depending on chop. Any xml tags will be closed/balanced.

Parameters:
input - The string that should be truncated.
length - max length of string (if choped the string will be '...' longer then max.)
chop - If words should be choped, or if we chop inbetween spaces.
Returns:
The truncated string


Copyright © 2005-2009 Schibsted ASA. All Rights Reserved.