Class StringUtil
java.lang.Object
org.eclipse.nebula.widgets.opal.commons.StringUtil
public class StringUtil
extends java.lang.Object
This class provides useful String manipulation methods
-
Constructor Summary
Constructors Constructor Description StringUtil()
-
Method Summary
Modifier and Type Method Description static java.lang.String
insertString(java.lang.String source, java.lang.String newEntry, int position)
Insert a string in a middle of another stringstatic boolean
isEmpty(java.lang.String source)
Check if a string is empty or nullstatic java.lang.String
removeCharAt(java.lang.String source, int position)
Remove a character in a Stringstatic java.lang.String
safeToString(java.lang.Object source)
Returns a "safe" string representation.static java.lang.String
stackStraceAsString(java.lang.Throwable exception)
Converts exception stack trace as string
-
Constructor Details
-
StringUtil
public StringUtil()
-
-
Method Details
-
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:
true
is the string is empty or null,false
otherwise
-
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
-