Package com.linkare.commons.utils
Class StringUtils
- java.lang.Object
-
- com.linkare.commons.utils.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 Summary
Fields Modifier and Type Field Description static StringLINE_SEPARATORThe default line separator stringstatic StringSYSTEM_PROP_LINE_SEPARATORThe system property representing the line separator
-
Constructor Summary
Constructors Modifier Constructor Description privateStringUtils()Hiding constructor so that this utility class cannot be instantiated from outside.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Stringappend(String firstWord, String secondWord, String... otherWords)static booleanisBlank(String word)Provides one utility method to check if awordis blank.static booleanisNotBlank(String word)Provides one utility method to check if awordis not blank.static Stringnewline()
-
-
-
Field Detail
-
LINE_SEPARATOR
public static final String LINE_SEPARATOR
The default line separator string- See Also:
- Constant Field Values
-
SYSTEM_PROP_LINE_SEPARATOR
public static final String SYSTEM_PROP_LINE_SEPARATOR
The system property representing the line separator- See Also:
- Constant Field Values
-
-
Method Detail
-
isBlank
public static boolean isBlank(String word)
Provides one utility method to check if awordis blank. Onewordis 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 awordis not blank. Onewordis said to be not blank if it's notisBlank(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_SEPARATORsystem property, if present. It returns theLINE_SEPARATORstring 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 tofirstWordandsecondWord.- Returns:
- the result of appending
firstWordwithsecondWordand withotherWords.
-
-