Jacson

de.spieleck.util
Class StringUtil

java.lang.Object
  extended byde.spieleck.util.StringUtil

public class StringUtil
extends java.lang.Object

A utility class providing operations for String objects

Author:
Patrick Carl, fsn

Constructor Summary
StringUtil()
           
 
Method Summary
static java.util.Set getTokensAsSet(java.lang.String string, char delim)
          Tokenize a String.
static java.util.Set getTokensAsSet(java.lang.String str, java.lang.String delims)
          Tokenize a String.
static java.lang.String translate(java.lang.String str, java.lang.String old, java.lang.String neu)
          Replace characters in a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtil

public StringUtil()
Method Detail

getTokensAsSet

public static java.util.Set getTokensAsSet(java.lang.String string,
                                           char delim)
Tokenize a String.

Parameters:
string - A string to tokenize
delim - the token separator char
Returns:
the tokens of the given String as a Set. A token of the given String is delimited by the given delim char.

getTokensAsSet

public static java.util.Set getTokensAsSet(java.lang.String str,
                                           java.lang.String delims)
Tokenize a String. Note: According to superficial benchmarks String.indexOf() is faster even as * special purpose Set implementations for delimiter numbers less than about 30.

Parameters:
str - A string to tokenize
delims - A set of characters to separate tokens
Returns:
the tokens of the given String as a Set. A token of the given String is delimited by the given delim char.

translate

public static java.lang.String translate(java.lang.String str,
                                         java.lang.String old,
                                         java.lang.String neu)
Replace characters in a String.

Parameters:
str - String to modify
old - "Set" of old characters
neu - "Set" of new characters

Spieleck

Copyleft 2002 spieleck.de.