proper.util
Class Strings

java.lang.Object
  extended by proper.util.Strings

public class Strings
extends java.lang.Object

This class provides some methods for String handling.

Version:
$Revision: 1.2 $
Author:
FracPete

Constructor Summary
Strings()
           
 
Method Summary
static java.util.Vector arrayToVector(java.lang.String[] array)
          transforms an array into a vector
static java.lang.String[] breakUp(java.lang.String s)
          breaks a strings into an array of strings with the standard delimiters from the StringTokenizer class
static java.lang.String[] breakUp(java.lang.String s, java.lang.String delimiter)
          breaks a strings into an array of strings with the given delimiters
static java.lang.String[] breakUp(java.lang.String s, java.lang.String delimiter, java.lang.String qualifier)
          breaks a strings into an array of strings with the given delimiters and the given text qualifier
static java.lang.String[] breakUp(java.lang.String s, java.lang.String delimiter, java.lang.String qualifier, int times)
          breaks a strings into an array of strings with the given delimiters and the given text qualifier, for the given number of times (-1 means unlimited)
static java.util.Vector breakUpVector(java.lang.String s)
          breaks a strings into a vector of strings with the standard delimiters from the StringTokenizer class
static java.util.Vector breakUpVector(java.lang.String s, java.lang.String delimiter)
          breaks a strings into a vector of strings with the given delimiters
static java.util.Vector breakUpVector(java.lang.String s, java.lang.String delimiter, java.lang.String qualifier)
          breaks a strings into a vector of strings with the given delimiters and the given text qualifier
static java.util.Vector breakUpVector(java.lang.String s, java.lang.String delimiter, java.lang.String qualifier, int times)
          breaks a strings into a vector of strings with the given delimiters and the given text qualifier
static java.lang.String escape(java.lang.String line)
          escapes \ and "
static java.lang.String[] fromCommalist(java.lang.String list)
          returns an array of the given comma separated list
static java.util.Vector fromCommalistVector(java.lang.String list)
          returns a vector of the given comma separated list
static java.lang.String left(java.lang.String s, int count)
          returns the "count" characters from the left, less if the string is shorter than "count"
static void main(java.lang.String[] args)
          for testing only
static java.lang.String replaceAll(java.lang.String src, java.lang.String replace, java.lang.String with)
          replaces the string "replace" in "src" with the string "with"
static java.lang.String right(java.lang.String s, int count)
          returns the "count" characters from the right, less if the string is shorter than "count"
static java.lang.String stringOf(char chr, int count)
          returns a string that consists of "count" times of character "chr"
static java.lang.String stringOf(java.lang.String str, int count)
          returns a string consists of "count" times of string "str"
static java.lang.String toCommalist(java.lang.String[] array)
          returns the array as a comma separated list
static java.lang.String toCommalistVector(java.util.Vector vector)
          returns the vector as a comma separated list
static java.lang.String[] vectorToArray(java.util.Vector vector)
          transforms the String-Vector into a String-Array
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Strings

public Strings()
Method Detail

breakUp

public static java.lang.String[] breakUp(java.lang.String s)
breaks a strings into an array of strings with the standard delimiters from the StringTokenizer class

Parameters:
s - the string to break up
Returns:
the parts of the string w/o the delimiters

breakUp

public static java.lang.String[] breakUp(java.lang.String s,
                                         java.lang.String delimiter)
breaks a strings into an array of strings with the given delimiters

Parameters:
s - the string to break up
delimiter - the delimiters to use (single characters!)
Returns:
the parts of the string w/o the delimiters

breakUp

public static java.lang.String[] breakUp(java.lang.String s,
                                         java.lang.String delimiter,
                                         java.lang.String qualifier)
breaks a strings into an array of strings with the given delimiters and the given text qualifier

Parameters:
s - the string to break up
delimiter - the delimiters to use (single characters!)
qualifier - the string qualifier, i.e. delimiters inside these are ignored
Returns:
the parts of the string w/o the delimiters

breakUp

public static java.lang.String[] breakUp(java.lang.String s,
                                         java.lang.String delimiter,
                                         java.lang.String qualifier,
                                         int times)
breaks a strings into an array of strings with the given delimiters and the given text qualifier, for the given number of times (-1 means unlimited)

Parameters:
s - the string to break up
delimiter - the delimiters to use (single characters!)
qualifier - the string qualifier, i.e. delimiters inside these are ignored
times - the maximum number of times to break up the string, where -1 is unlimited
Returns:
the parts of the string w/o the delimiters

breakUpVector

public static java.util.Vector breakUpVector(java.lang.String s)
breaks a strings into a vector of strings with the standard delimiters from the StringTokenizer class

Parameters:
s - the string to break up
Returns:
the parts of the string w/o the delimiters

breakUpVector

public static java.util.Vector breakUpVector(java.lang.String s,
                                             java.lang.String delimiter)
breaks a strings into a vector of strings with the given delimiters

Parameters:
s - the string to break up
delimiter - the delimiters to use (single characters!)
Returns:
the parts of the string w/o the delimiters

breakUpVector

public static java.util.Vector breakUpVector(java.lang.String s,
                                             java.lang.String delimiter,
                                             java.lang.String qualifier)
breaks a strings into a vector of strings with the given delimiters and the given text qualifier

Parameters:
s - the string to break up
delimiter - the delimiters to use (single characters!)
qualifier - the string qualifier, i.e. delimiters inside these are ignored
Returns:
the parts of the string w/o the delimiters

breakUpVector

public static java.util.Vector breakUpVector(java.lang.String s,
                                             java.lang.String delimiter,
                                             java.lang.String qualifier,
                                             int times)
breaks a strings into a vector of strings with the given delimiters and the given text qualifier

Parameters:
s - the string to break up
delimiter - the delimiters to use (single characters!)
qualifier - the string qualifier, i.e. delimiters inside these are ignored
times - the maximum number of times to break up the string, where -1 is unlimited
Returns:
the parts of the string w/o the delimiters

arrayToVector

public static java.util.Vector arrayToVector(java.lang.String[] array)
transforms an array into a vector


vectorToArray

public static java.lang.String[] vectorToArray(java.util.Vector vector)
transforms the String-Vector into a String-Array


escape

public static java.lang.String escape(java.lang.String line)
escapes \ and "


fromCommalist

public static java.lang.String[] fromCommalist(java.lang.String list)
returns an array of the given comma separated list


fromCommalistVector

public static java.util.Vector fromCommalistVector(java.lang.String list)
returns a vector of the given comma separated list


toCommalist

public static java.lang.String toCommalist(java.lang.String[] array)
returns the array as a comma separated list


toCommalistVector

public static java.lang.String toCommalistVector(java.util.Vector vector)
returns the vector as a comma separated list


replaceAll

public static java.lang.String replaceAll(java.lang.String src,
                                          java.lang.String replace,
                                          java.lang.String with)
replaces the string "replace" in "src" with the string "with"


left

public static java.lang.String left(java.lang.String s,
                                    int count)
returns the "count" characters from the left, less if the string is shorter than "count"


right

public static java.lang.String right(java.lang.String s,
                                     int count)
returns the "count" characters from the right, less if the string is shorter than "count"


stringOf

public static java.lang.String stringOf(char chr,
                                        int count)
returns a string that consists of "count" times of character "chr"


stringOf

public static java.lang.String stringOf(java.lang.String str,
                                        int count)
returns a string consists of "count" times of string "str"


main

public static void main(java.lang.String[] args)
for testing only