Package io.github.handsomecoder.utils
Class StringUtils
- java.lang.Object
-
- io.github.handsomecoder.utils.StringUtils
-
public class StringUtils extends Object
The type String utils.- Author:
- Harsh Shah
-
-
Field Summary
Fields Modifier and Type Field Description static StringHASH_WITH_SHA_256The constant HASH_WITH_SHA_256.
-
Constructor Summary
Constructors Constructor Description StringUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Stringbuilder(String... values)Builder string.static StringbytesToHex(byte[] hash)Bytes to hex string.static StringgetHash(String str, String algo)Gets hash.static booleanisAllEmpty(String... strings)Is all empty boolean.static booleanisAnyEmpty(String... strs)Is any empty boolean.static booleanisEmpty(String str)Is empty boolean.static booleanisNotEmpty(String str)Is not empty boolean.static Stringjoin(String delimiter, String... strs)Join string.static Stringjoin(String delimiter, List<String> strs)Join string.static Stringrepeat(String str, int count)Repeat string.static StringrepeatAndJoin(String str, int count, String with)Repeat and join string.static Stringreplace(String str, String regex, String replacement)Replace string.static String[]splitAndTrim(String str, String regex)Split and trim string [ ].static StringvalueOf(Object value)Value of string.
-
-
-
Field Detail
-
HASH_WITH_SHA_256
public static final String HASH_WITH_SHA_256
The constant HASH_WITH_SHA_256.- See Also:
- Constant Field Values
-
-
Method Detail
-
isEmpty
public static boolean isEmpty(String str)
Is empty boolean.- Parameters:
str- the str- Returns:
- boolean boolean
-
isNotEmpty
public static boolean isNotEmpty(String str)
Is not empty boolean.- Parameters:
str- the str- Returns:
- boolean boolean
-
isAnyEmpty
public static boolean isAnyEmpty(String... strs)
Is any empty boolean.- Parameters:
strs- the strs- Returns:
- boolean boolean
-
isAllEmpty
public static boolean isAllEmpty(String... strings)
Is all empty boolean.- Parameters:
strings- the strings- Returns:
- boolean boolean
-
builder
public static String builder(String... values)
Builder string.- Parameters:
values- the values- Returns:
- string string
-
valueOf
public static String valueOf(Object value)
Value of string.- Parameters:
value- the value- Returns:
- string string
-
getHash
public static String getHash(String str, String algo)
Gets hash.- Parameters:
str- the stralgo- the algo- Returns:
- hash hash
-
bytesToHex
public static String bytesToHex(byte[] hash)
Bytes to hex string.- Parameters:
hash- the hash- Returns:
- string string
-
repeat
public static String repeat(String str, int count)
Repeat string.- Parameters:
str- the strcount- the count- Returns:
- string string
-
repeatAndJoin
public static String repeatAndJoin(String str, int count, String with)
Repeat and join string.- Parameters:
str- the strcount- the countwith- the with- Returns:
- string string
-
splitAndTrim
public static String[] splitAndTrim(String str, String regex)
Split and trim string [ ].- Parameters:
str- the strregex- the regex- Returns:
- string [ ]
-
replace
public static String replace(String str, String regex, String replacement)
Replace string.- Parameters:
str- the strregex- the regexreplacement- the replacement- Returns:
- string string
-
join
public static String join(String delimiter, List<String> strs)
Join string.- Parameters:
delimiter- the delimiterstrs- the strs- Returns:
- string string
-
-