net.sourceforge.pebble.util
Class StringUtils

java.lang.Object
  extended by net.sourceforge.pebble.util.StringUtils

public final class StringUtils
extends java.lang.Object

A collection of utility methods for manipulating strings.

Author:
Simon Brown

Field Summary
static int MAX_CONTENT_LENGTH
           
static int MAX_WORD_LENGTH
           
 
Constructor Summary
StringUtils()
           
 
Method Summary
static java.lang.String filterHTML(java.lang.String s)
          Filters out all HTML tags.
static java.lang.String filterNewlines(java.lang.String s)
          Filters out newline characters.
static java.lang.String stripScriptTags(java.lang.String html)
           
static java.lang.String transformHTML(java.lang.String s)
          Filters out characters that have meaning within JSP and HTML, and replaces them with "escaped" versions.
static java.lang.String transformToHTMLSubset(java.lang.String s)
          Transforms the given String into a subset of HTML displayable on a web page.
static java.lang.String truncate(java.lang.String s)
           
static java.lang.String truncate(java.lang.String s, int maxLength)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_CONTENT_LENGTH

public static final int MAX_CONTENT_LENGTH
See Also:
Constant Field Values

MAX_WORD_LENGTH

public static final int MAX_WORD_LENGTH
See Also:
Constant Field Values
Constructor Detail

StringUtils

public StringUtils()
Method Detail

transformHTML

public static java.lang.String transformHTML(java.lang.String s)
Filters out characters that have meaning within JSP and HTML, and replaces them with "escaped" versions.

Parameters:
s - the String to filter
Returns:
the filtered String

transformToHTMLSubset

public static java.lang.String transformToHTMLSubset(java.lang.String s)
Transforms the given String into a subset of HTML displayable on a web page. The subset includes <b>, <i>, <p>, <br>, <pre> and <a href> (and their corresponding end tags).

Parameters:
s - the String to transform
Returns:
the transformed String

filterNewlines

public static java.lang.String filterNewlines(java.lang.String s)
Filters out newline characters.

Parameters:
s - the String to filter
Returns:
the filtered String

filterHTML

public static java.lang.String filterHTML(java.lang.String s)
Filters out all HTML tags.

Parameters:
s - the String to filter
Returns:
the filtered String

truncate

public static java.lang.String truncate(java.lang.String s)

truncate

public static java.lang.String truncate(java.lang.String s,
                                        int maxLength)

stripScriptTags

public static java.lang.String stripScriptTags(java.lang.String html)


Copyright © 2003-2006, Simon Brown. All Rights Reserved.