org.ow2.dragon.util
Class StringHelper

java.lang.Object
  extended by org.ow2.dragon.util.StringHelper

public final class StringHelper
extends java.lang.Object

Initial developer(s): Adrien LOUIS

Author:
alouis, ofabre - EBM Websourcing

Method Summary
static boolean equal(java.lang.String a, java.lang.String b)
          Test the equality of the specified strings. test is : ( (a==b==null) || a.equals(b) )
static boolean equalIgnoreCase(java.lang.String a, java.lang.String b)
          Same as equal, with ignoreCase
static java.lang.String extractValueForAttribute(java.lang.String string, java.lang.String attribute, java.lang.String separator)
          TODO use Tokenizer Extract in the given String the value corresponding to the given attribute: ".......
static boolean isNullOrEmpty(java.lang.String s)
          Return true if the String is null or its size is 0.
static java.lang.String replace(java.lang.String line, char oldChar, char newChar)
          Replace an old character by a new one in the given string
static java.util.List<java.lang.String> splitPathElements(java.lang.String path)
          Split the given String path into String path elements.
static java.lang.String toString(java.io.InputStream inputStream)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

equal

public static boolean equal(java.lang.String a,
                            java.lang.String b)
Test the equality of the specified strings. test is : ( (a==b==null) || a.equals(b) )

Parameters:
a -
b -
Returns:

equalIgnoreCase

public static boolean equalIgnoreCase(java.lang.String a,
                                      java.lang.String b)
Same as equal, with ignoreCase

Parameters:
a -
b -
Returns:

extractValueForAttribute

public static java.lang.String extractValueForAttribute(java.lang.String string,
                                                        java.lang.String attribute,
                                                        java.lang.String separator)
TODO use Tokenizer Extract in the given String the value corresponding to the given attribute: ".......=VALUE......". - not case sensitive - return the first value for the first matching attribute - the separator between ATT and VALUE must be : "="

Parameters:
string - can be null or empty (return null)
attribute - can be null or empty (return null)
separator - (";"," ","&"...) can be null or empty. in this case, take the end of the String : "ATT="
Returns:
the found attribute value, null otherwise

isNullOrEmpty

public static boolean isNullOrEmpty(java.lang.String s)
Return true if the String is null or its size is 0.

Parameters:
s -
Returns:

splitPathElements

public static java.util.List<java.lang.String> splitPathElements(java.lang.String path)
Split the given String path into String path elements. For example, the following path "/foo/bar" will be split into two parts "foo" and "bar", returned in List. If the given path includes empty path elements (Ex: "/foo//bar//"), the returned List doesn't contain these elements (for this exemple result will be "foo","bar").

Parameters:
path - the String path to split, can be null or empty (return an empty ArrayList)
Returns:
a List of String path elements, cannot be null, can be empty

replace

public static java.lang.String replace(java.lang.String line,
                                       char oldChar,
                                       char newChar)
Replace an old character by a new one in the given string

Parameters:
line - the String to modify
oldChar - the character to be replaced
newChar - the replacement character
Returns:
the new String with character replaced

toString

public static java.lang.String toString(java.io.InputStream inputStream)
                                 throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2008-2009 eBMWebsourcing. All Rights Reserved.