Skip to content

Commit bf8a01e

Browse files
author
shengshijun
committed
完成字符串压缩
bugfix
1 parent b2c542c commit bf8a01e

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/main/java/ssj/algorithm/string/StringUntil.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ public static String replaceSpace(String s) {
130130
}
131131

132132
public static String compress(String str) {
133+
if (str == null || str.isEmpty()) {
134+
return str;
135+
}
133136
StringBuilder sb = new StringBuilder(str.length());
134137
int cur = 0;
135138
while (cur < str.length()) {

0 commit comments

Comments
 (0)