Class StringUtil


  • public final class StringUtil
    extends Object
    String manipulation utilities.
    Author:
    James Ahlborn
    • Method Detail

      • isEmpty

        public static boolean isEmpty​(String str)
      • isBlank

        public static boolean isBlank​(String str)
      • startsWithIgnoreCase

        public static boolean startsWithIgnoreCase​(String str,
                                                   String prefix)
      • trimToNull

        public static String trimToNull​(String str)
      • toUpperCase

        public static String toUpperCase​(String str)
        Converts in the root locale, which is what a value compared against the database rather than shown to a user needs. The locale default would turn an "i" into "İ" in Turkish.
        Returns:
        the given string in upper case, or null if it is null
      • truncate

        public static String truncate​(String str,
                                      int maxLength)
        Returns:
        the given string, cut to the given length if it is longer than that, and unchanged if it is null
      • remove

        public static String remove​(String str,
                                    char c)