MCPcopy Create free account
hub / github.com/e2wugui/zeze / trim

Method trim

ZezeJava/ZezeJava/src/main/java/Zeze/Util/Str.java:57–73  ·  view source on GitHub ↗
(String @Nullable [] strs)

Source from the content-addressed store, hash-verified

55 }
56
57 public static String @NotNull [] trim(String @Nullable [] strs) {
58 if (strs == null)
59 return EMPTY;
60 int n = 0;
61 for (int i = 0; i < strs.length; i++)
62 if (strs[i] != null && !(strs[i] = strs[i].trim()).isEmpty())
63 n++;
64 if (n == strs.length)
65 return strs;
66 if (n == 0)
67 return EMPTY;
68 String[] newStrs = new String[n];
69 for (int i = 0, j = 0; i < strs.length; i++)
70 if (strs[i] != null && !strs[i].isEmpty())
71 newStrs[j++] = strs[i];
72 return newStrs;
73 }
74
75 public static @NotNull String stacktrace(@NotNull Throwable ex) {
76 try (var out = new ByteArrayOutputStream();

Callers 15

startMethod · 0.95
onEndStreamMethod · 0.80
onEndStreamMethod · 0.80
parseMethod · 0.80
ServiceManagerConfMethod · 0.80
EmptyToNullStringMethod · 0.80
DatabaseConfMethod · 0.80
TableConfMethod · 0.80
ModuleMethod · 0.80
splitIntoSetMethod · 0.80
registerMethod · 0.80

Calls 1

isEmptyMethod · 0.65

Tested by

no test coverage detected