Package es.gob.afirma.tsl.utils
Class UtilsStringChar
- java.lang.Object
-
- es.gob.afirma.tsl.utils.UtilsStringChar
-
public final class UtilsStringChar extends java.lang.ObjectClass 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_VALIDATORSConstant attribute that represents the array with all the characters defined as constants in this class.static java.lang.StringEMPTY_STRINGConstant attribute that represents the string to identify the empty string.static charSPECIAL_BLANK_SPACEConstant attribute that represents the char to identify the blank space character.static java.lang.StringSPECIAL_BLANK_SPACE_STRINGConstant attribute that represents the string to identify the blank space character.static charSPECIAL_LINE_BREAKConstant attribute that represents the char to identify the line break character.static java.lang.StringSPECIAL_LINE_BREAK_STRINGConstant attribute that represents the string to identify the line break character.static charSPECIAL_LINE_STARTConstant attribute that represents the char to identify the line start character.static java.lang.StringSPECIAL_LINE_START_STRINGConstant attribute that represents the string to identify the line start character.static java.lang.StringSPECIAL_SYSTEM_LINE_SEPARATOR_STRINGConstant attribute that represents the string to identify the line separator character in this system.static charSPECIAL_TABULATIONConstant attribute that represents the char to identify the tabulation character.static java.lang.StringSPECIAL_TABULATION_STRINGConstant attribute that represents the string to identify the tabulation character.static charSYMBOL_AMPERSANDConstant attribute that represents the char to identify the symbol:&.static java.lang.StringSYMBOL_AMPERSAND_STRINGConstant attribute that represents the string to identify the symbol:&.static charSYMBOL_ASTERISKConstant attribute that represents the char to identify the symbol:*.static java.lang.StringSYMBOL_ASTERISK_STRINGConstant attribute that represents the string to identify the symbol:*.static charSYMBOL_CLOSE_BRACKETConstant attribute that represents the char to identify the symbol:).static java.lang.StringSYMBOL_CLOSE_BRACKET_STRINGConstant attribute that represents the string to identify the symbol:).static charSYMBOL_CLOSE_SQUARE_BRACKETConstant attribute that represents the char to identify the symbol:].static java.lang.StringSYMBOL_CLOSE_SQUARE_BRACKET_STRINGConstant attribute that represents the string to identify the symbol:].static charSYMBOL_COLONConstant attribute that represents the char to identify the symbol::.static java.lang.StringSYMBOL_COLON_STRINGConstant attribute that represents the string to identify the symbol::.static charSYMBOL_COMMAConstant attribute that represents the char to identify the symbol:,.static java.lang.StringSYMBOL_COMMA_STRINGConstant attribute that represents the string to identify the symbol:,.static charSYMBOL_DOTConstant attribute that represents the char to identify the symbol:..static java.lang.StringSYMBOL_DOT_STRINGConstant attribute that represents the string to identify the symbol:..static charSYMBOL_EQUALConstant attribute that represents the char to identify the symbol:=.static java.lang.StringSYMBOL_EQUAL_STRINGConstant attribute that represents the string to identify the symbol:=.static charSYMBOL_ESCAPED_BACKSLASHConstant attribute that represents the char to identify the symbol:\.static java.lang.StringSYMBOL_ESCAPED_BACKSLASH_STRINGConstant attribute that represents the string to identify the symbol:\.static charSYMBOL_HYPHENConstant attribute that represents the char to identify the symbol:-.static java.lang.StringSYMBOL_HYPHEN_STRINGConstant attribute that represents the string to identify the symbol:-.static charSYMBOL_OPEN_BRACKETConstant attribute that represents the char to identify the symbol:(.static java.lang.StringSYMBOL_OPEN_BRACKET_STRINGConstant attribute that represents the string to identify the symbol:(.static charSYMBOL_OPEN_SQUARE_BRACKETConstant attribute that represents the char to identify the symbol:[.static java.lang.StringSYMBOL_OPEN_SQUARE_BRACKET_STRINGConstant attribute that represents the string to identify the symbol:[.static charSYMBOL_PADConstant attribute that represents the char to identify the symbol:#.static java.lang.StringSYMBOL_PAD_STRINGConstant attribute that represents the string to identify the symbol:#.static charSYMBOL_PIPEConstant attribute that represents the char to identify the symbol:|.static java.lang.StringSYMBOL_PIPE_STRINGConstant attribute that represents the string to identify the symbol:|.static charSYMBOL_QUESTION_MARKConstant attribute that represents the char to identify the symbol:?static java.lang.StringSYMBOL_QUESTION_MARK_STRINGConstant attribute that represents the string to identify the symbol:?static charSYMBOL_SEMICOLONConstant attribute that represents the char to identify the symbol:;.static java.lang.StringSYMBOL_SEMICOLON_STRINGConstant attribute that represents the string to identify the symbol:;.static charSYMBOL_SLASHConstant attribute that represents the char to identify the symbol:/.static java.lang.StringSYMBOL_SLASH_STRINGConstant attribute that represents the string to identify the symbol:/.static java.lang.StringSYMBOL_STRING_ONLY_LETTER_NUMBERConstant attribute that represents strings that are neither letters nor numbers
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcleanStringBuilder(java.lang.StringBuilder sb)To free resources, this method sets the length of the inputStringBuilderto zero and then trim it.static booleancontainsSomeOfTheCharacterSet(java.lang.String str)Method that checks whether a string contains some of the characters contained inCHARACTERS_SET_TO_VALIDATORS(true) or not (false).static booleancontainsSomeOfTheCharacterSetInTheSet(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 booleanisNullOrEmpty(java.lang.String str)Method that checks whether a string is null or empty.static booleanisNullOrEmptyTrim(java.lang.String str)Method that checks whether a string is null or empty after to apply the methodString.trim()on.static booleanlistContainingString(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.StringremoveBlanksFromString(java.lang.String string)Removes all the blanks from the input string.
-
-
-
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
truevalue whether the string is null or empty, orfalsevalue 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 methodString.trim()on.- Parameters:
str- Parameter that represents the string to process.- Returns:
- a boolean with
truevalue whether the string is null or empty, orfalsevalue in another case.
-
containsSomeOfTheCharacterSet
public static boolean containsSomeOfTheCharacterSet(java.lang.String str)
Method that checks whether a string contains some of the characters contained inCHARACTERS_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 inputStringBuilderto zero and then trim it.- Parameters:
sb- String builder to clean. If it isnull, this method do nothing.
-
removeBlanksFromString
public static java.lang.String removeBlanksFromString(java.lang.String string)
Removes all the blanks from the input string. It is considered how blanks:SPECIAL_BLANK_SPACE_STRING,SPECIAL_LINE_BREAK_STRING,SPECIAL_LINE_START_STRINGandSPECIAL_TABULATION_STRING.- Parameters:
string- String from what removes the blanks.- Returns:
- a empty string if the input parameter is
null, otherwise, the same input string after removes the blanks.
-
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.
-
-