org.mmbase.remote
Class Strip

java.lang.Object
  |
  +--org.mmbase.remote.Strip

public class Strip
extends java.lang.Object

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"
 

Version:
12 Mar 1997
Author:
Rico Jansen

Field Summary
static int BOTH
          Strip both, characters at begin and end of string are checked
static int LEADING
          Strip leading, only characters at begin of string are checked
static int NOTHING
          Strip nothing, a rather ineffecient form of a copy
static int TRAILING
          Strip trailing, only characters at end of string are checked
 
Constructor Summary
Strip()
           
 
Method Summary
static java.lang.String Char(java.lang.String str, char chr, int where)
          Strip one character from beginning, end or both.
static java.lang.String Chars(java.lang.String str, java.lang.String chars, int where)
          Strip multiple characters contained in the set given as second parameter until a non-set character.
static java.lang.String DoubleQuote(java.lang.String str, int where)
          Strip double quotes from beginning, end or both, only once.
static void main(java.lang.String[] args)
          Test the class
static java.lang.String SingleQuote(java.lang.String str, int where)
          Strip single quotes from beginning, end or both, only once.
static java.lang.String Whitespace(java.lang.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOTHING

public static final int NOTHING
Strip nothing, a rather ineffecient form of a copy

LEADING

public static final int LEADING
Strip leading, only characters at begin of string are checked

TRAILING

public static final int TRAILING
Strip trailing, only characters at end of string are checked

BOTH

public static final int BOTH
Strip both, characters at begin and end of string are checked
Constructor Detail

Strip

public Strip()
Method Detail

DoubleQuote

public static java.lang.String DoubleQuote(java.lang.String str,
                                           int where)
Strip double quotes from beginning, end or both, only once.

SingleQuote

public static java.lang.String SingleQuote(java.lang.String str,
                                           int where)
Strip single quotes from beginning, end or both, only once.

Whitespace

public static java.lang.String Whitespace(java.lang.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.

Char

public static java.lang.String Char(java.lang.String str,
                                    char chr,
                                    int where)
Strip one character from beginning, end or both.

Chars

public static java.lang.String Chars(java.lang.String str,
                                     java.lang.String chars,
                                     int where)
Strip multiple characters contained in the set given as second parameter until a non-set character.

main

public static void main(java.lang.String[] args)
Test the class


MMBase 2002