Class StringUtil

java.lang.Object
de.muehlencord.shared.util.StringUtil

public abstract class StringUtil extends Object
Author:
Joern Muehlencord (joern@muehlencord.de)
  • Constructor Details

    • StringUtil

      public StringUtil()
  • Method Details

    • getISOString

      public static String getISOString(String input) throws StringEncodingException
      returns the given string in ISO-8859-1 encoding
      Parameters:
      input - the input string in UTF-8
      Returns:
      the converted string in
      Throws:
      StringEncodingException - if the string cannot be converted
    • getStackTraceString

      public static String getStackTraceString(Throwable ex)
      returns the stackstrace as one string
      Parameters:
      ex - the exception to return the string for
      Returns:
      the stackstrace as one string
    • getBlankedString

      public static String getBlankedString(int length, String s)
      fills s with blanks if s < length
      Parameters:
      length - the needed length for this field
      s - the field to extend with blanks
      Returns:
      s extended by trailing blanks. s.length == length
    • getValueBetweenKeywords

      public static String getValueBetweenKeywords(String content, String keyWord1, String keyWord2) throws ParseException
      returns the string located between the two given keywords
      Parameters:
      content - the string to get the value from
      keyWord1 - the starting keyword
      keyWord2 - the end keyword
      Returns:
      the string between keyword1 and keyword2
      Throws:
      ParseException - if the value cannot be determined - e.g. if one of the keywords is not found
    • isEmpty

      public static boolean isEmpty(String s)
      returns true, if given string is either null or a blank string
      Parameters:
      s - the string to check
      Returns:
      true, if s is either null or s.equals("")
    • getEnumString

      public static <E extends Enum<E>> String getEnumString(Class<E> clazz, E[] enumValues, String method)
    • getCommaListString

      public static <T> String getCommaListString(Class<T> clazz, T[] typeArray, String methodName) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
      Throws:
      NoSuchMethodException
      IllegalAccessException
      IllegalArgumentException
      InvocationTargetException