|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jplate.foundation.util.TrimWhiteSpace
public final class TrimWhiteSpace
This class can trim white space from an entire string. By default, white space is defined as newline, tab, carriage return and space. You may also supply user definable white space for trimming.
Consider the following examples:trimWhiteSpace ( "Hello, my name is\n\tScot" )
will yeild Hello,mynameisScot
trimWhiteSpace ( "Hello, my name is\tScot", "mn" )
will yeild Hello, y ae is Scot
Modifications: $Date: 2008-12-02 12:32:45 -0500 (Tue, 02 Dec 2008) $ $Revision: 479 $ $Author: sfloess $ $HeadURL: https://jplate.svn.sourceforge.net/svnroot/jplate/trunk/src/dev/java/org/jplate/foundation/util/TrimWhiteSpace.java $
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_WHITE_SPACE
This is the default white space to trim. |
Constructor Summary | |
---|---|
private |
TrimWhiteSpace()
Default constructor not allowed. |
Method Summary | |
---|---|
private static java.lang.String |
trimActualWhiteSpace(java.lang.String str,
java.lang.String whiteSpace)
Removes the characters contained in whiteSpace from
str . |
static java.lang.String |
trimWhiteSpace(java.lang.String str)
Removes the characters contained in DEFAULT_WHITE_SPACE from
str . |
static java.lang.String |
trimWhiteSpace(java.lang.String str,
java.lang.String whiteSpace)
Removes the characters contained in whiteSpace from
str . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_WHITE_SPACE
Constructor Detail |
---|
private TrimWhiteSpace()
java.lang.UnsupportedOperationException
- if this constructor is called.Method Detail |
---|
private static java.lang.String trimActualWhiteSpace(java.lang.String str, java.lang.String whiteSpace)
whiteSpace
from
str
.
str
- The string from which the characters contained in
whiteSpace
are removed.whiteSpace
- The string containing whitespace characters that should be
removed from str
.
whiteSpace
from str
.public static java.lang.String trimWhiteSpace(java.lang.String str, java.lang.String whiteSpace)
whiteSpace
from
str
. If whiteSpace
is null or the empty string,
DEFAULT_WHITE_SPACE
will be used.
str
- The string from which the characters contained in
whiteSpace
are removed.whiteSpace
- The string containing whitespace characters
that should be removed from str
.
whiteSpace
from str
.DEFAULT_WHITE_SPACE
public static java.lang.String trimWhiteSpace(java.lang.String str)
DEFAULT_WHITE_SPACE
from
str
.
str
- The string from which the characters contained in
DEFAULT_WHITE_SPACE
are removed.
DEFAULT_WHITE_SPACE
from str
.DEFAULT_WHITE_SPACE
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |