Class StringUtils


  • public class StringUtils
    extends Object
    Utility methods for strings.
    • Constructor Detail

      • StringUtils

        public StringUtils()
    • Method Detail

      • isEmpty

        public static boolean isEmpty​(String string)
        Returns true if given string is null or length is zero.
      • removeTrailing

        public static String removeTrailing​(String string,
                                            String trailing)
      • split

        public static List<String> split​(String str,
                                         char delim,
                                         boolean trim,
                                         boolean excludeEmpty)
        Splits a string at the specified delimiter. If trimming is enabled, then leading and trailing whitespace characters are removed. If excludeEmpty is true, then only non-empty strings are returned.
        Since:
        2
      • substringTrimmed

        public static String substringTrimmed​(String str,
                                              int beginIndex)
        This is equal to str.substring( beginIndex, endIndex ).trim(), but avoids temporary untrimmed substring allocation. If the trimmed string is empty, a shared empty string is returned.
        Since:
        2
      • substringTrimmed

        public static String substringTrimmed​(String str,
                                              int beginIndex,
                                              int endIndex)
        This is equal to str.substring( beginIndex ).trim(), but avoids temporary untrimmed substring allocation. If the trimmed string is empty, a shared empty string is returned.
        Since:
        2
      • isTrimmedEmpty

        public static boolean isTrimmedEmpty​(String str)
        This is equal to str.trim().isEmpty(), but avoids temporary trimmed substring allocation.
        Since:
        2