Package io.hawt.util
Class Strings
- java.lang.Object
-
- io.hawt.util.Strings
-
public class Strings extends Object
String utility.
-
-
Constructor Summary
Constructors Constructor Description Strings()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringcleanPath(String path)Normalizes a path.static booleanisBlank(String text)static booleanisNotBlank(String text)static Stringsanitize(String name)Strip out any annoying to deal with characters from a string when used as a file or directory namestatic StringsanitizeDirectory(String name)Also remove any dots in the directory namestatic List<String>split(String text, String delimiter)static Stringstrip(String text, String chars)static StringtrimString(String value, int max)static StringwebContextPath(String first, String... more)Creates a web context path from components.
-
-
-
Method Detail
-
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- Parameters:
name-- Returns:
-
sanitizeDirectory
public static String sanitizeDirectory(String name)
Also remove any dots in the directory name- Parameters:
name-- Returns:
-
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:- stripped from all multiple consecutive occurrences of '/' characters
- 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:- prefixed with '/' character
- stripped from all multiple consecutive occurrences of '/' characters
- stripped from trailing '/' character(s)
- Parameters:
components- web context path components- Returns:
- empty string or string which starts with a "/" character but does not end with a "/" character
-
-