com.funambol.util
Class StringUtil

java.lang.Object
  extended by com.funambol.util.StringUtil

public class StringUtil
extends java.lang.Object

Utility class useful when dealing with string objects. This class is a collection of static functions, and the usage is: StringUtil.method() it is not allowed to create instances of this class


Method Summary
static boolean equalsIgnoreCase(java.lang.String string1, java.lang.String string2)
          This method is missing in CLDC 1.0 String implementation
static int findEmptyLine(java.lang.String s)
          Find two consecutive newlines in a string.
static java.lang.String fold(java.lang.String recipients)
          Builds a list of the recipients email addresses each on a different line, starting just from the second line with an HT ("\t") separator at the head of the line.
static boolean getBooleanValue(java.lang.String string)
          Util method for retrieve a boolean primitive type from a String.
static java.lang.String[] getStringArray(java.util.Vector stringVec)
          Returns the string array
static boolean isNullOrEmpty(java.lang.String str)
          Returns true if the given string is null or empty.
static java.lang.String join(java.lang.String[] list, java.lang.String sep)
          Split the string into an array of strings using one of the separator in 'sep'.
static java.lang.String removeBackslashes(java.lang.String content)
          Removes unwanted backslashes characters
static java.lang.String removeBlanks(java.lang.String content)
          Removes unwanted blank characters
static java.lang.String[] split(java.lang.String s, java.lang.String sep)
          Split the string into an array of strings using one of the separator in 'sep'.
static java.lang.String trim(java.lang.String s, char c)
          Removes characters 'c' from the beginning and the end of the string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

split

public static java.lang.String[] split(java.lang.String s,
                                       java.lang.String sep)
Split the string into an array of strings using one of the separator in 'sep'.

Parameters:
s - the string to tokenize
sep - a list of separator to use
Returns:
the array of tokens (an array of size 1 with the original string if no separator found)

join

public static java.lang.String join(java.lang.String[] list,
                                    java.lang.String sep)
Split the string into an array of strings using one of the separator in 'sep'.

Parameters:
list - the string array to join
sep - the separator to use
Returns:
the joined string

getStringArray

public static java.lang.String[] getStringArray(java.util.Vector stringVec)
Returns the string array

Parameters:
stringVec - the Vecrot of tring to convert
Returns:
String []

findEmptyLine

public static int findEmptyLine(java.lang.String s)
Find two consecutive newlines in a string.

Parameters:
s - - The string to search
Returns:
int: the position of the empty line

removeBlanks

public static java.lang.String removeBlanks(java.lang.String content)
Removes unwanted blank characters

Parameters:
content -
Returns:
String

removeBackslashes

public static java.lang.String removeBackslashes(java.lang.String content)
Removes unwanted backslashes characters

Parameters:
content - The string containing the backslashes to be removed
Returns:
the content without backslashes

fold

public static java.lang.String fold(java.lang.String recipients)
Builds a list of the recipients email addresses each on a different line, starting just from the second line with an HT ("\t") separator at the head of the line. This is an implementation of the 'folding' concept from the RFC 2822 (§ 2.2.3)

Parameters:
recipients - A string containing all recipients comma-separated
Returns:
A string containing the email list of the recipients spread over more lines, ended by CRLF and beginning from the second with the WSP defined in the RFC 2822

equalsIgnoreCase

public static boolean equalsIgnoreCase(java.lang.String string1,
                                       java.lang.String string2)
This method is missing in CLDC 1.0 String implementation


getBooleanValue

public static boolean getBooleanValue(java.lang.String string)
Util method for retrieve a boolean primitive type from a String. Implemented because Boolean class doesn't provide parseBoolean() method


trim

public static java.lang.String trim(java.lang.String s,
                                    char c)
Removes characters 'c' from the beginning and the end of the string


isNullOrEmpty

public static boolean isNullOrEmpty(java.lang.String str)
Returns true if the given string is null or empty.



Copyright © 2006 Funambol.