com.ibm.di.util
Class StringUtils

java.lang.Object
  extended by com.ibm.di.util.StringUtils

public class StringUtils
extends Object


Field Summary
 Exception lastError
           
 
Constructor Summary
StringUtils()
           
 
Method Summary
static void appendHex(byte b, StringBuilder buffer)
           
static void appendHex(char c, StringBuilder buffer)
           
static byte fromHex(String hex)
           
static String fromPrint(String str)
           
 Exception getLastError()
           
static byte nibble(char ch)
           
static String[] splitString(String s, char delim)
          Split string into non-empty tokens using the specified delimeter.
static Vector<String> splitstring(String str, String key)
           
static String[] splitstringArr(String str, String key)
           
static int splitStringTokenCount(String s, char delim)
          Calculates the number of non-empty tokens in a string.
static String toASCII(String s)
          Convert a string to ASCII.
 String toBase64(String source)
           
static String toHex(byte b)
           
static String toHex(char c)
           
static String toHex(String str)
           
static String toPrint(String str)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lastError

public Exception lastError
Constructor Detail

StringUtils

public StringUtils()
Method Detail

getLastError

public Exception getLastError()

toHex

public static String toHex(byte b)

appendHex

public static void appendHex(byte b,
                             StringBuilder buffer)

appendHex

public static void appendHex(char c,
                             StringBuilder buffer)

toHex

public static String toHex(char c)

toHex

public static String toHex(String str)

nibble

public static byte nibble(char ch)
                   throws NumberFormatException
Throws:
NumberFormatException

fromHex

public static byte fromHex(String hex)
                    throws NumberFormatException
Throws:
NumberFormatException

toPrint

public static String toPrint(String str)

fromPrint

public static String fromPrint(String str)

splitstring

public static Vector<String> splitstring(String str,
                                         String key)

splitstringArr

public static String[] splitstringArr(String str,
                                      String key)

toBase64

public String toBase64(String source)

toASCII

public static String toASCII(String s)
Convert a string to ASCII. Non-ASCII characters will be escaped using the Unicode escape Java notation: "\\uxxx".

Parameters:
s - A string, which may include non ASCII characters.
Returns:
A string that contains only ASCII characters.

splitStringTokenCount

public static int splitStringTokenCount(String s,
                                        char delim)
Calculates the number of non-empty tokens in a string.

Parameters:
s -
delim -
Returns:
See Also:
splitString(String, char)

splitString

public static String[] splitString(String s,
                                   char delim)
Split string into non-empty tokens using the specified delimeter. This routine is supposed to be faster than String.split(String).

Parameters:
s - String to be split into tokens.
delim - Delimeter character.
Returns:
An array of tokens. Will never be null.
See Also:
splitStringTokenCount(String, char)