Package com.saperion.util
Class SaStringHelper
- java.lang.Object
-
- com.saperion.util.SaStringHelper
-
public final class SaStringHelper extends java.lang.Object
Utility class for helper methods.- Author:
- mak
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
EMPTY_STRING
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
collectionToString(java.lang.String separator, java.util.Collection<java.lang.String> collection)
Creates a string containing all strings in the collection separated by the specified separator.static java.lang.String
inputStreamToString(java.io.InputStream is)
Reads the content of a Stream into a String.static boolean
isEmpty(java.lang.String str)
Test if the string is empty or not.static java.lang.String
prepareDatabaseName(java.lang.String dbName)
Removes all '[', ']' and '"' from the passed string.static java.lang.String
readerToString(java.io.Reader is)
Reads the entire content of a Reader into a String.static java.lang.String
toLowerCaseUnicode(java.lang.String str)
static java.lang.String
toUpperCaseUnicode(java.lang.String str)
-
-
-
Field Detail
-
EMPTY_STRING
public static final java.lang.String EMPTY_STRING
- See Also:
- Constant Field Values
-
-
Method Detail
-
isEmpty
public static boolean isEmpty(java.lang.String str)
Test if the string is empty or not.- Parameters:
str
- Incomming string- Returns:
- True, if the string is empty
-
readerToString
public static java.lang.String readerToString(java.io.Reader is) throws java.io.IOException
Reads the entire content of a Reader into a String.- Parameters:
is
- input Reader- Returns:
String
- Throws:
java.io.IOException
- IOException
-
inputStreamToString
public static java.lang.String inputStreamToString(java.io.InputStream is) throws java.io.IOException
Reads the content of a Stream into a String.- Parameters:
is
- the input stream- Returns:
String
- Throws:
java.io.IOException
- IOException
-
toLowerCaseUnicode
public static java.lang.String toLowerCaseUnicode(java.lang.String str)
- Parameters:
str
- original string- Returns:
- the
String
, converted to lowercase.
-
toUpperCaseUnicode
public static java.lang.String toUpperCaseUnicode(java.lang.String str)
- Parameters:
str
- original string- Returns:
- the
String
, converted to uppercase.
-
collectionToString
public static java.lang.String collectionToString(java.lang.String separator, java.util.Collection<java.lang.String> collection)
Creates a string containing all strings in the collection separated by the specified separator. It does not add whitespaces, so don't forget to add a whitespace to your separator if required.- Parameters:
separator
- the separatorcollection
- the collection- Returns:
- the string
-
prepareDatabaseName
public static java.lang.String prepareDatabaseName(java.lang.String dbName)
Removes all '[', ']' and '"' from the passed string.- Parameters:
dbName
- original database name- Returns:
- cleaned database name
-
-