MCPcopy Create free account
hub / github.com/SEBV1/idlefish_monitor / StringUtils

Class StringUtils

src/main/java/com/github/utils/StringUtils.java:5–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3import java.util.Locale;
4
5public class StringUtils {
6 public static String concatStr(String str, String str2) {
7 if (isBlank(str) || isBlank(str2)) {
8 return null;
9 }
10 return str.trim() + "$" + str2.trim();
11 }
12
13 public static String concatStr2LowerCase(String str, String str2) {
14 if (isBlank(str) || isBlank(str2)) {
15 return null;
16 }
17 return (str.trim() + "$" + str2.trim()).toLowerCase(Locale.US);
18 }
19
20 public static boolean isBlank(String str) {
21 int length;
22 if (str != null && (length = str.length()) != 0) {
23 for (int i = 0; i < length; i++) {
24 if (!Character.isWhitespace(str.charAt(i))) {
25 return false;
26 }
27 }
28 }
29 return true;
30 }
31
32 public static boolean isEmpty(String str) {
33 return str == null || str.length() == 0;
34 }
35
36 public static boolean isNotBlank(String str) {
37 return !isBlank(str);
38 }
39
40 public static boolean isStringEqual(String str, String str2) {
41 return (str == null && str2 == null) || (str != null && str.equals(str2));
42 }
43
44 public static String[] splitString(String str, String str2) {
45 if (str == null || str.length() == 0) {
46 return null;
47 }
48 if (isBlank(str2)) {
49 return new String[]{str2};
50 }
51 try {
52 return str.split(str2);
53 } catch (Throwable unused) {
54 return new String[]{str};
55 }
56 }
57
58 public static String concatStr2LowerCase(String str, String... strArr) {
59 if (isBlank(str) || strArr == null) {
60 return null;
61 }
62 StringBuilder sb = new StringBuilder();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected