Class StringUtil
- java.lang.Object
-
- org.eclipse.nebula.widgets.opal.commons.StringUtil
-
public class StringUtil extends java.lang.ObjectThis class provides useful String manipulation methods
-
-
Constructor Summary
Constructors Constructor Description StringUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringinsertString(java.lang.String source, java.lang.String newEntry, int position)Insert a string in a middle of another stringstatic booleanisEmpty(java.lang.String source)Check if a string is empty or nullstatic java.lang.StringremoveCharAt(java.lang.String source, int position)Remove a character in a Stringstatic java.lang.StringsafeToString(java.lang.Object source)Returns a "safe" string representation.static java.lang.StringstackStraceAsString(java.lang.Throwable exception)Converts exception stack trace as string
-
-
-
Method Detail
-
safeToString
public static java.lang.String safeToString(java.lang.Object source)
Returns a "safe" string representation. If source is null, return an empty string- Parameters:
source- source string- Returns:
- the string representation of the source (without space) if the
source is not
null, or an empty string otherwise
-
isEmpty
public static boolean isEmpty(java.lang.String source)
Check if a string is empty or null- Parameters:
source- source string- Returns:
trueis the string is empty or null,falseotherwise
-
stackStraceAsString
public static final java.lang.String stackStraceAsString(java.lang.Throwable exception)
Converts exception stack trace as string- Parameters:
exception- exception to convert- Returns:
- a string that contains the exception
-
insertString
public static java.lang.String insertString(java.lang.String source, java.lang.String newEntry, int position)Insert a string in a middle of another string- Parameters:
source- source stringnewEntry- string to insert into sourceposition- position to insert source- Returns:
- the new string
-
removeCharAt
public static java.lang.String removeCharAt(java.lang.String source, int position)Remove a character in a String- Parameters:
source- source stringposition- position of the character to remove- Returns:
- the string without the character
-
-