Class 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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 separator
        collection - 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