Package io.hawt.util

Class Strings

java.lang.Object
io.hawt.util.Strings

public class Strings extends Object
String utility.
  • Constructor Details

    • Strings

      public Strings()
  • Method Details

    • trimString

      public static String trimString(String value, int max)
    • isBlank

      public static boolean isBlank(String text)
    • isNotBlank

      public static boolean isNotBlank(String text)
    • sanitize

      public static String sanitize(String name)
      Strip out any annoying to deal with characters from a string when used as a file or directory name
    • sanitizeDirectory

      public static String sanitizeDirectory(String name)
      Also remove any dots in the directory name
    • split

      public static List<String> split(String text, String delimiter)
    • cleanPath

      public static String cleanPath(String path)
      Normalizes a path. If the path contains a single '/' character it is returned unchanged, otherwise the path is:
      1. stripped from all multiple consecutive occurrences of '/' characters
      2. stripped from trailing '/' character(s)
      Parameters:
      path - path to normalize
      Returns:
      normalized path
    • webContextPath

      public static String webContextPath(String first, String... more)
      Creates a web context path from components. Concatenates all path components using '/' character as delimiter and the result is then:
      1. prefixed with '/' character
      2. stripped from all multiple consecutive occurrences of '/' characters
      3. stripped from trailing '/' character(s)
      Returns:
      empty string or string which starts with a "/" character but does not end with a "/" character
    • strip

      public static String strip(String text, String chars)