| java.lang.Object org.mmbase.util.Strip
Strip | public class Strip (Code) | | Class to strip characters from the beginning and end of strings.
Example1: Strip.Char("..dfld..",'.',Strip.TRAILING) yields "..dlfd."
Example2: Strip.Chars("..dfld..",".",Strip.TRAILING) yields "..dlfd"
Example3: Strip.Chars(". .. dfld. , .","., ",Strip.BOTH) yields "dfld"
author: Rico Jansen version: $Id: Strip.java,v 1.7 2004/09/30 14:07:13 pierre Exp $ |
Field Summary | |
final public static int | BOTH | final public static int | LEADING | final public static int | NOTHING | final public static int | TRAILING |
Method Summary | |
public static String | Char(String str, char chr, int where) Strip all of the specified character from beginning, end or both. | public static String | Chars(String str, String chars, int where) Strip multiple characters contained in the set given as second parameter
until a non-set character. | public static String | DoubleQuote(String str, int where) Strip double quotes from beginning, end or both, only once. | public static String | SingleQuote(String str, int where) Strip single quotes from beginning, end or both, only once. | public static String | Whitespace(String str, int where) Strip multiple whitespace characters from beginning, end or both, that
means keep on stripping util a non-whitespace character is found. | public static void | main(String args) |
BOTH | final public static int BOTH(Code) | | Strip both, characters at begin and end of string are checked
|
LEADING | final public static int LEADING(Code) | | Strip leading, only characters at begin of string are checked
|
NOTHING | final public static int NOTHING(Code) | | Strip nothing, a rather ineffecient form of a copy
|
TRAILING | final public static int TRAILING(Code) | | Strip trailing, only characters at end of string are checked
|
Chars | public static String Chars(String str, String chars, int where)(Code) | | Strip multiple characters contained in the set given as second parameter
until a non-set character.
Parameters: str - the string to strip Parameters: chars - a string containing all characters to strip from the string Parameters: where - one of Strip.NOTHING, Strip.LEADING, Strip.TRAILINGor Strip.BOTH the stripped String |
Whitespace | public static String Whitespace(String str, int where)(Code) | | Strip multiple whitespace characters from beginning, end or both, that
means keep on stripping util a non-whitespace character is found.
Parameters: str - the string to strip Parameters: where - one of Strip.NOTHING, Strip.LEADING, Strip.TRAILINGor Strip.BOTH the stripped String |
main | public static void main(String args)(Code) | | Test the class
|
|
|