Merge pull request #390 from MasterSJ/master

循环中查找的空格,如果填充的也是空格就死循环了
This commit is contained in:
郑永川 2018-08-28 21:49:43 +08:00 committed by GitHub
commit 51bc928087
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -232,7 +232,7 @@ public String replaceSpace(StringBuffer str) {
int P1 = str.length() - 1;
for (int i = 0; i < str.length(); i++)
if (str.charAt(i) == ' ')
str.append(" ");
str.append("aa");
int P2 = str.length() - 1;
while (P1 >= 0 && P2 > P1) {