net.lessy.util
Class StringUtil

java.lang.Object
  extended by net.lessy.util.StringUtil

public class StringUtil
extends Object

All kind of String-Utility Methods

Author:
Hans Lesmeister

Constructor Summary
StringUtil()
           
 
Method Summary
static StringBuilder concatenate(Object... objects)
          Concats an array of objects
static String concatenateNotEmpty(String s1, String s2)
          Concats 2 objects separated by a space.
static String concatenateNotEmpty(String sep, String s1, String s2)
          Concats 2 objects with an optional separator.
static boolean isEmpty(String s)
          Prueft ob uebergebene Zeichenkette null oder ist bzw nur aus white spaces besteht.
static String objectToString(Object obj)
          Gets the toString-Version of the passed object or null if the object is null
static String objectToString(Object obj, String defValue)
          Gets the toString-Version of the passed object or the passed default if the object is null
static String toUpperLower(String value)
          Converts a String to the Format "Xxxxxx".
static String trim(String value)
          Trim with respect of Nullpointer
 
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

trim

public static String trim(String value)
Trim with respect of Nullpointer

Parameters:
value - The value to be trimmed
Returns:
Trimmed String or null if the passed String was null

concatenate

public static StringBuilder concatenate(Object... objects)
Concats an array of objects

Parameters:
objects - Objects
Returns:
Concatenated

concatenateNotEmpty

public static String concatenateNotEmpty(String sep,
                                         String s1,
                                         String s2)
Concats 2 objects with an optional separator. Sep. is only inserted if objects are both not null

Returns:
Concatenated string

concatenateNotEmpty

public static String concatenateNotEmpty(String s1,
                                         String s2)
Concats 2 objects separated by a space. Sep. is only inserted if objects are both not null

Returns:
Concatenated string

isEmpty

public static boolean isEmpty(String s)
Prueft ob uebergebene Zeichenkette null oder ist bzw nur aus white spaces besteht.

Returns:
true, wenn Zeichenkette aus mindestens einem nocn-white-space Zeichen besteht, ansonsten false

objectToString

public static String objectToString(Object obj)
Gets the toString-Version of the passed object or null if the object is null

Parameters:
obj - Object
Returns:
String-Representation or null

objectToString

public static String objectToString(Object obj,
                                    String defValue)
Gets the toString-Version of the passed object or the passed default if the object is null

Parameters:
obj - Object
defValue - To be returned if obj is null
Returns:
String-Representation or defValue

toUpperLower

public static String toUpperLower(String value)
Converts a String to the Format "Xxxxxx".



Copyright © 2012. All Rights Reserved.