Class StringUtils


  • public final class StringUtils
    extends Object
    Utility class that groups commons operations related to strings.
    Since:
    0.0.1
    Author:
    Paulo Zenida - Linkare TI
    • Field Detail

      • SYSTEM_PROP_LINE_SEPARATOR

        public static final String SYSTEM_PROP_LINE_SEPARATOR
        The system property representing the line separator
        See Also:
        Constant Field Values
    • Constructor Detail

      • StringUtils

        private StringUtils()
        Hiding constructor so that this utility class cannot be instantiated from outside.
    • Method Detail

      • isBlank

        public static boolean isBlank​(String word)
        Provides one utility method to check if a word is blank. One word is said to be blank when it's null or, after being trimmed, it has a length of 0 (zero).
        Parameters:
        word - the word to be checked
        Returns:
        Returns true if the word is blank. Returns false otherwise.
      • isNotBlank

        public static boolean isNotBlank​(String word)
        Provides one utility method to check if a word is not blank. One word is said to be not blank if it's not isBlank(word).
        Parameters:
        word - the word to be checked
        Returns:
        Returns true if the word is not blank. Returns false otherwise.
        See Also:
        isBlank(String)
      • newline

        public static String newline()
        Returns:
        the new line string, according to the SYSTEM_PROP_LINE_SEPARATOR system property, if present. It returns the LINE_SEPARATOR string otherwise.
      • append

        public static final String append​(String firstWord,
                                          String secondWord,
                                          String... otherWords)
        Parameters:
        firstWord - the first word to be the output of this method.
        secondWord - the second word to be appended to be appended.
        otherWords - an optional list of words to be appended to firstWord and secondWord.
        Returns:
        the result of appending firstWord with secondWord and with otherWords.