Class UtilsStringChar


  • public final class UtilsStringChar
    extends java.lang.Object

    Class that provides functionality for managing strings and characters.

    Project:

    Library for the integration with the services of @Firma, eVisor and TS@.

    Version:
    1.0, 10/10/2020.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static char[] CHARACTERS_SET_TO_VALIDATORS
      Constant attribute that represents the array with all the characters defined as constants in this class.
      static java.lang.String EMPTY_STRING
      Constant attribute that represents the string to identify the empty string.
      static char SPECIAL_BLANK_SPACE
      Constant attribute that represents the char to identify the blank space character.
      static java.lang.String SPECIAL_BLANK_SPACE_STRING
      Constant attribute that represents the string to identify the blank space character.
      static char SPECIAL_LINE_BREAK
      Constant attribute that represents the char to identify the line break character.
      static java.lang.String SPECIAL_LINE_BREAK_STRING
      Constant attribute that represents the string to identify the line break character.
      static char SPECIAL_LINE_START
      Constant attribute that represents the char to identify the line start character.
      static java.lang.String SPECIAL_LINE_START_STRING
      Constant attribute that represents the string to identify the line start character.
      static java.lang.String SPECIAL_SYSTEM_LINE_SEPARATOR_STRING
      Constant attribute that represents the string to identify the line separator character in this system.
      static char SPECIAL_TABULATION
      Constant attribute that represents the char to identify the tabulation character.
      static java.lang.String SPECIAL_TABULATION_STRING
      Constant attribute that represents the string to identify the tabulation character.
      static char SYMBOL_AMPERSAND
      Constant attribute that represents the char to identify the symbol: &.
      static java.lang.String SYMBOL_AMPERSAND_STRING
      Constant attribute that represents the string to identify the symbol: &.
      static char SYMBOL_ASTERISK
      Constant attribute that represents the char to identify the symbol: *.
      static java.lang.String SYMBOL_ASTERISK_STRING
      Constant attribute that represents the string to identify the symbol: *.
      static char SYMBOL_CLOSE_BRACKET
      Constant attribute that represents the char to identify the symbol: ).
      static java.lang.String SYMBOL_CLOSE_BRACKET_STRING
      Constant attribute that represents the string to identify the symbol: ).
      static char SYMBOL_CLOSE_SQUARE_BRACKET
      Constant attribute that represents the char to identify the symbol: ].
      static java.lang.String SYMBOL_CLOSE_SQUARE_BRACKET_STRING
      Constant attribute that represents the string to identify the symbol: ].
      static char SYMBOL_COLON
      Constant attribute that represents the char to identify the symbol: :.
      static java.lang.String SYMBOL_COLON_STRING
      Constant attribute that represents the string to identify the symbol: :.
      static char SYMBOL_COMMA
      Constant attribute that represents the char to identify the symbol: ,.
      static java.lang.String SYMBOL_COMMA_STRING
      Constant attribute that represents the string to identify the symbol: ,.
      static char SYMBOL_DOT
      Constant attribute that represents the char to identify the symbol: ..
      static java.lang.String SYMBOL_DOT_STRING
      Constant attribute that represents the string to identify the symbol: ..
      static char SYMBOL_EQUAL
      Constant attribute that represents the char to identify the symbol: =.
      static java.lang.String SYMBOL_EQUAL_STRING
      Constant attribute that represents the string to identify the symbol: =.
      static char SYMBOL_ESCAPED_BACKSLASH
      Constant attribute that represents the char to identify the symbol: \.
      static java.lang.String SYMBOL_ESCAPED_BACKSLASH_STRING
      Constant attribute that represents the string to identify the symbol: \.
      static char SYMBOL_HYPHEN
      Constant attribute that represents the char to identify the symbol: -.
      static java.lang.String SYMBOL_HYPHEN_STRING
      Constant attribute that represents the string to identify the symbol: -.
      static char SYMBOL_OPEN_BRACKET
      Constant attribute that represents the char to identify the symbol: (.
      static java.lang.String SYMBOL_OPEN_BRACKET_STRING
      Constant attribute that represents the string to identify the symbol: (.
      static char SYMBOL_OPEN_SQUARE_BRACKET
      Constant attribute that represents the char to identify the symbol: [.
      static java.lang.String SYMBOL_OPEN_SQUARE_BRACKET_STRING
      Constant attribute that represents the string to identify the symbol: [.
      static char SYMBOL_PAD
      Constant attribute that represents the char to identify the symbol: #.
      static java.lang.String SYMBOL_PAD_STRING
      Constant attribute that represents the string to identify the symbol: #.
      static char SYMBOL_PIPE
      Constant attribute that represents the char to identify the symbol: |.
      static java.lang.String SYMBOL_PIPE_STRING
      Constant attribute that represents the string to identify the symbol: |.
      static char SYMBOL_QUESTION_MARK
      Constant attribute that represents the char to identify the symbol: ?
      static java.lang.String SYMBOL_QUESTION_MARK_STRING
      Constant attribute that represents the string to identify the symbol: ?
      static char SYMBOL_SEMICOLON
      Constant attribute that represents the char to identify the symbol: ;.
      static java.lang.String SYMBOL_SEMICOLON_STRING
      Constant attribute that represents the string to identify the symbol: ;.
      static char SYMBOL_SLASH
      Constant attribute that represents the char to identify the symbol: /.
      static java.lang.String SYMBOL_SLASH_STRING
      Constant attribute that represents the string to identify the symbol: /.
      static java.lang.String SYMBOL_STRING_ONLY_LETTER_NUMBER
      Constant attribute that represents strings that are neither letters nor numbers
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void cleanStringBuilder​(java.lang.StringBuilder sb)
      To free resources, this method sets the length of the input StringBuilder to zero and then trim it.
      static boolean containsSomeOfTheCharacterSet​(java.lang.String str)
      Method that checks whether a string contains some of the characters contained in CHARACTERS_SET_TO_VALIDATORS (true) or not (false).
      static boolean containsSomeOfTheCharacterSetInTheSet​(java.lang.String str, char[] characterSet)
      Method that checks whether a string contains some of the characters contained in certain characters array (true) or not (false).
      static boolean isNullOrEmpty​(java.lang.String str)
      Method that checks whether a string is null or empty.
      static boolean isNullOrEmptyTrim​(java.lang.String str)
      Method that checks whether a string is null or empty after to apply the method String.trim() on.
      static boolean listContainingString​(java.util.List<java.lang.String> listString, java.lang.String stringParam)
      Method that checks if a string is found in a list of strings as part of the string.
      static java.lang.String removeBlanksFromString​(java.lang.String string)
      Removes all the blanks from the input string.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • EMPTY_STRING

        public static final java.lang.String EMPTY_STRING
        Constant attribute that represents the string to identify the empty string.
        See Also:
        Constant Field Values
      • SPECIAL_BLANK_SPACE

        public static final char SPECIAL_BLANK_SPACE
        Constant attribute that represents the char to identify the blank space character.
        See Also:
        Constant Field Values
      • SPECIAL_BLANK_SPACE_STRING

        public static final java.lang.String SPECIAL_BLANK_SPACE_STRING
        Constant attribute that represents the string to identify the blank space character.
      • SPECIAL_SYSTEM_LINE_SEPARATOR_STRING

        public static final java.lang.String SPECIAL_SYSTEM_LINE_SEPARATOR_STRING
        Constant attribute that represents the string to identify the line separator character in this system.
      • SPECIAL_LINE_BREAK

        public static final char SPECIAL_LINE_BREAK
        Constant attribute that represents the char to identify the line break character.
        See Also:
        Constant Field Values
      • SPECIAL_LINE_BREAK_STRING

        public static final java.lang.String SPECIAL_LINE_BREAK_STRING
        Constant attribute that represents the string to identify the line break character.
      • SPECIAL_LINE_START

        public static final char SPECIAL_LINE_START
        Constant attribute that represents the char to identify the line start character.
        See Also:
        Constant Field Values
      • SPECIAL_LINE_START_STRING

        public static final java.lang.String SPECIAL_LINE_START_STRING
        Constant attribute that represents the string to identify the line start character.
      • SPECIAL_TABULATION

        public static final char SPECIAL_TABULATION
        Constant attribute that represents the char to identify the tabulation character.
        See Also:
        Constant Field Values
      • SPECIAL_TABULATION_STRING

        public static final java.lang.String SPECIAL_TABULATION_STRING
        Constant attribute that represents the string to identify the tabulation character.
      • SYMBOL_PAD

        public static final char SYMBOL_PAD
        Constant attribute that represents the char to identify the symbol: #.
        See Also:
        Constant Field Values
      • SYMBOL_PAD_STRING

        public static final java.lang.String SYMBOL_PAD_STRING
        Constant attribute that represents the string to identify the symbol: #.
      • SYMBOL_AMPERSAND

        public static final char SYMBOL_AMPERSAND
        Constant attribute that represents the char to identify the symbol: &.
        See Also:
        Constant Field Values
      • SYMBOL_AMPERSAND_STRING

        public static final java.lang.String SYMBOL_AMPERSAND_STRING
        Constant attribute that represents the string to identify the symbol: &.
      • SYMBOL_COLON

        public static final char SYMBOL_COLON
        Constant attribute that represents the char to identify the symbol: :.
        See Also:
        Constant Field Values
      • SYMBOL_COLON_STRING

        public static final java.lang.String SYMBOL_COLON_STRING
        Constant attribute that represents the string to identify the symbol: :.
      • SYMBOL_SEMICOLON

        public static final char SYMBOL_SEMICOLON
        Constant attribute that represents the char to identify the symbol: ;.
        See Also:
        Constant Field Values
      • SYMBOL_SEMICOLON_STRING

        public static final java.lang.String SYMBOL_SEMICOLON_STRING
        Constant attribute that represents the string to identify the symbol: ;.
      • SYMBOL_EQUAL

        public static final char SYMBOL_EQUAL
        Constant attribute that represents the char to identify the symbol: =.
        See Also:
        Constant Field Values
      • SYMBOL_EQUAL_STRING

        public static final java.lang.String SYMBOL_EQUAL_STRING
        Constant attribute that represents the string to identify the symbol: =.
      • SYMBOL_HYPHEN

        public static final char SYMBOL_HYPHEN
        Constant attribute that represents the char to identify the symbol: -.
        See Also:
        Constant Field Values
      • SYMBOL_HYPHEN_STRING

        public static final java.lang.String SYMBOL_HYPHEN_STRING
        Constant attribute that represents the string to identify the symbol: -.
      • SYMBOL_COMMA

        public static final char SYMBOL_COMMA
        Constant attribute that represents the char to identify the symbol: ,.
        See Also:
        Constant Field Values
      • SYMBOL_COMMA_STRING

        public static final java.lang.String SYMBOL_COMMA_STRING
        Constant attribute that represents the string to identify the symbol: ,.
      • SYMBOL_DOT

        public static final char SYMBOL_DOT
        Constant attribute that represents the char to identify the symbol: ..
        See Also:
        Constant Field Values
      • SYMBOL_DOT_STRING

        public static final java.lang.String SYMBOL_DOT_STRING
        Constant attribute that represents the string to identify the symbol: ..
      • SYMBOL_SLASH

        public static final char SYMBOL_SLASH
        Constant attribute that represents the char to identify the symbol: /.
        See Also:
        Constant Field Values
      • SYMBOL_SLASH_STRING

        public static final java.lang.String SYMBOL_SLASH_STRING
        Constant attribute that represents the string to identify the symbol: /.
      • SYMBOL_QUESTION_MARK

        public static final char SYMBOL_QUESTION_MARK
        Constant attribute that represents the char to identify the symbol: ?.
        See Also:
        Constant Field Values
      • SYMBOL_QUESTION_MARK_STRING

        public static final java.lang.String SYMBOL_QUESTION_MARK_STRING
        Constant attribute that represents the string to identify the symbol: ?.
      • SYMBOL_ESCAPED_BACKSLASH

        public static final char SYMBOL_ESCAPED_BACKSLASH
        Constant attribute that represents the char to identify the symbol: \.
        See Also:
        Constant Field Values
      • SYMBOL_ESCAPED_BACKSLASH_STRING

        public static final java.lang.String SYMBOL_ESCAPED_BACKSLASH_STRING
        Constant attribute that represents the string to identify the symbol: \.
      • SYMBOL_OPEN_SQUARE_BRACKET

        public static final char SYMBOL_OPEN_SQUARE_BRACKET
        Constant attribute that represents the char to identify the symbol: [.
        See Also:
        Constant Field Values
      • SYMBOL_OPEN_SQUARE_BRACKET_STRING

        public static final java.lang.String SYMBOL_OPEN_SQUARE_BRACKET_STRING
        Constant attribute that represents the string to identify the symbol: [.
      • SYMBOL_CLOSE_SQUARE_BRACKET

        public static final char SYMBOL_CLOSE_SQUARE_BRACKET
        Constant attribute that represents the char to identify the symbol: ].
        See Also:
        Constant Field Values
      • SYMBOL_CLOSE_SQUARE_BRACKET_STRING

        public static final java.lang.String SYMBOL_CLOSE_SQUARE_BRACKET_STRING
        Constant attribute that represents the string to identify the symbol: ].
      • SYMBOL_OPEN_BRACKET

        public static final char SYMBOL_OPEN_BRACKET
        Constant attribute that represents the char to identify the symbol: (.
        See Also:
        Constant Field Values
      • SYMBOL_OPEN_BRACKET_STRING

        public static final java.lang.String SYMBOL_OPEN_BRACKET_STRING
        Constant attribute that represents the string to identify the symbol: (.
      • SYMBOL_CLOSE_BRACKET

        public static final char SYMBOL_CLOSE_BRACKET
        Constant attribute that represents the char to identify the symbol: ).
        See Also:
        Constant Field Values
      • SYMBOL_CLOSE_BRACKET_STRING

        public static final java.lang.String SYMBOL_CLOSE_BRACKET_STRING
        Constant attribute that represents the string to identify the symbol: ).
      • SYMBOL_ASTERISK

        public static final char SYMBOL_ASTERISK
        Constant attribute that represents the char to identify the symbol: *.
        See Also:
        Constant Field Values
      • SYMBOL_ASTERISK_STRING

        public static final java.lang.String SYMBOL_ASTERISK_STRING
        Constant attribute that represents the string to identify the symbol: *.
      • SYMBOL_PIPE

        public static final char SYMBOL_PIPE
        Constant attribute that represents the char to identify the symbol: |.
        See Also:
        Constant Field Values
      • SYMBOL_PIPE_STRING

        public static final java.lang.String SYMBOL_PIPE_STRING
        Constant attribute that represents the string to identify the symbol: |.
      • SYMBOL_STRING_ONLY_LETTER_NUMBER

        public static final java.lang.String SYMBOL_STRING_ONLY_LETTER_NUMBER
        Constant attribute that represents strings that are neither letters nor numbers
        See Also:
        Constant Field Values
      • CHARACTERS_SET_TO_VALIDATORS

        public static final char[] CHARACTERS_SET_TO_VALIDATORS
        Constant attribute that represents the array with all the characters defined as constants in this class.
    • Method Detail

      • isNullOrEmpty

        public static boolean isNullOrEmpty​(java.lang.String str)
        Method that checks whether a string is null or empty.
        Parameters:
        str - Parameter that represents the string to process.
        Returns:
        a boolean with true value whether the string is null or empty, or false value in another case.
      • isNullOrEmptyTrim

        public static boolean isNullOrEmptyTrim​(java.lang.String str)
        Method that checks whether a string is null or empty after to apply the method String.trim() on.
        Parameters:
        str - Parameter that represents the string to process.
        Returns:
        a boolean with true value whether the string is null or empty, or false value in another case.
      • containsSomeOfTheCharacterSet

        public static boolean containsSomeOfTheCharacterSet​(java.lang.String str)
        Method that checks whether a string contains some of the characters contained in CHARACTERS_SET_TO_VALIDATORS (true) or not (false).
        Parameters:
        str - Parameter that represents the string to process.
        Returns:
        a boolean that indicates whether a string contains some of the characters contained in CHARACTERS_SET_TO_VALIDATORS (true) or not (false).
      • containsSomeOfTheCharacterSetInTheSet

        public static boolean containsSomeOfTheCharacterSetInTheSet​(java.lang.String str,
                                                                    char[] characterSet)
        Method that checks whether a string contains some of the characters contained in certain characters array (true) or not (false).
        Parameters:
        str - Parameter that represents the string to process.
        characterSet - Parameter that represents the characters array to process.
        Returns:
        a boolean that indicates whether a string contains some of the characters contained in certain characters array (true) or not (false).
      • cleanStringBuilder

        public static void cleanStringBuilder​(java.lang.StringBuilder sb)
        To free resources, this method sets the length of the input StringBuilder to zero and then trim it.
        Parameters:
        sb - String builder to clean. If it is null, this method do nothing.
      • listContainingString

        public static boolean listContainingString​(java.util.List<java.lang.String> listString,
                                                   java.lang.String stringParam)
        Method that checks if a string is found in a list of strings as part of the string.
        Parameters:
        listString - String list where you want to search for the string.
        stringParam - String to search for.
        Returns:
        True, if the string was found within the list.