循环中查找的空格,如果填充的也是空格就死循环了
This commit is contained in:
parent
9e98742585
commit
0fd224b3ab
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user