Class StringHelper

java.lang.Object
de.fraunhofer.iosb.ilt.frostserver.util.StringHelper

public class StringHelper extends Object
Author:
jab
  • Field Details

    • UTF8

      public static final Charset UTF8
    • FORMAT_MOMENT

      public static final net.time4j.format.expert.ChronoPrinter<net.time4j.Moment> FORMAT_MOMENT
    • FORMAT_INTERVAL

      public static final net.time4j.format.expert.ChronoPrinter<net.time4j.range.MomentInterval> FORMAT_INTERVAL
  • Method Details

    • capitalize

      public static String capitalize(String string)
    • deCapitalize

      public static String deCapitalize(String string)
    • isNullOrEmpty

      public static boolean isNullOrEmpty(String string)
    • isNullOrEmpty

      public static boolean isNullOrEmpty(Collection collection)
    • cleanForOutput

      public static String cleanForOutput(String string, int maxLength)
      Replaces characters that might cause problems in HTML and limits the length of the string. Currently everything that is not [A-Za-z0-9',;?/-] is changed to a ?.
      Parameters:
      string - The string to clean.
      maxLength - The maximum length of string to return.
      Returns:
      The cleaned string.
    • cleanForOutput

      public static String cleanForOutput(String string)
      Replaces characters that might cause problems in HTML. Currently everything that is not [A-Za-z0-9',;?/-] is changed to a ?.
      Parameters:
      string - The string to clean.
      Returns:
      The cleaned string.
    • cleanForLogging

      public static String cleanForLogging(String string)
      Replaces characters that might break logging output. Currently: \n, \r and \t
      Parameters:
      string - The string to clean.
      Returns:
      The cleaned string.
    • cleanForLogging

      public static String cleanForLogging(Object object)
      Null-Save replaces characters that might break logging output. Currently: \n, \r and \t
      Parameters:
      object - The Object to clean.
      Returns:
      The cleaned string.
    • escapeForStringConstant

      public static String escapeForStringConstant(String in)
      Replaces all ' in the string with ''.
      Parameters:
      in - The string to escape.
      Returns:
      The escaped string.
    • urlEncode

      public static String urlEncode(String input)
    • urlDecode

      public static String urlDecode(String input)
      Decode the given input using UTF-8 as character set.
      Parameters:
      input - The input to urlDecode.
      Returns:
      The decoded input.
    • urlEncodeNotSlashes

      public static String urlEncodeNotSlashes(String string)
      Urlencodes the given string, except for the forward slashes.
      Parameters:
      string - The string to urlEncode.
      Returns:
      The urlEncoded string.