IMC Epclient 5.0.3

at.spardat.enterprise.util
Class StringUtil

java.lang.Object
  extended byat.spardat.enterprise.util.StringUtil

public class StringUtil
extends java.lang.Object

Some string utility functions


Constructor Summary
StringUtil()
           
 
Method Summary
static void appendN(char c, int n, java.lang.StringBuffer b)
          appends n times a given character to a StringBuffer
static boolean consistsOnlyOf(java.lang.String s, java.lang.String chars)
          Yields true, if s consists only of characters in chars.
static java.lang.String decode(java.lang.String in, char escapeCharacter)
          Expects an string encoded with method encode and makes the inverse transformation, i.e., decode(encode(s)) == s.
static java.lang.String encode(java.lang.String in, char escapeCharacter)
          Encodes a string so that all characters with unicode less than 128 that are not in the character range [0-9a-zA-Z ] are represented by an escape character (which might be a character which is less than 128 and not in the set [0-9a-zA-Z ]) followed by a two digit hexadecimal unicode value.
static void main(java.lang.String[] args)
           
static java.util.ArrayList split(java.lang.String s, java.lang.String delim)
          Assumes that s consists of strings seperated by delimiters and extracts the former.
 
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

appendN

public static void appendN(char c,
                           int n,
                           java.lang.StringBuffer b)
appends n times a given character to a StringBuffer


consistsOnlyOf

public static boolean consistsOnlyOf(java.lang.String s,
                                     java.lang.String chars)
Yields true, if s consists only of characters in chars. Returns true if the length of s is zero.


encode

public static java.lang.String encode(java.lang.String in,
                                      char escapeCharacter)
Encodes a string so that all characters with unicode less than 128 that are not in the character range [0-9a-zA-Z ] are represented by an escape character (which might be a character which is less than 128 and not in the set [0-9a-zA-Z ]) followed by a two digit hexadecimal unicode value.

Parameters:
in - string to encode
escapeCharacter - the escape character
Returns:
encoded string

decode

public static java.lang.String decode(java.lang.String in,
                                      char escapeCharacter)
Expects an string encoded with method encode and makes the inverse transformation, i.e., decode(encode(s)) == s.

Parameters:
in - the string to decode
escapeCharacter - the same character used in encode.

split

public static java.util.ArrayList split(java.lang.String s,
                                        java.lang.String delim)
Assumes that s consists of strings seperated by delimiters and extracts the former. Suppose this holds the String "ab--cd----ef--", then split("--") yields the 5 strings { "ab", "cd", "", "ef", "" }.

Parameters:
s - the non-null string to split
delim - specifies string that act as delimiter
Returns:
ArrayList of extracted java.lang.Strings.

main

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

IMC Epclient 5.0.3