mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 02:09:59 +07:00
StringConcatenationInLoopsInspection: automatically create append chains
This commit is contained in:
@@ -4,6 +4,7 @@ public class Main {
|
||||
String test(String[] strings) {
|
||||
StringBuilder res = new StringBuilder();
|
||||
for (String s : strings) {
|
||||
res.append(s).append("\n");
|
||||
res.append(s);
|
||||
}
|
||||
return res.toString();
|
||||
|
||||
@@ -8,7 +8,12 @@ public class Main {
|
||||
if (/*before*/res.length() > 0) {
|
||||
res.append(", ");
|
||||
}
|
||||
res.append(s);
|
||||
if (s.contains("'")) {
|
||||
res.append('[' // bracket
|
||||
).append(s).append(']');
|
||||
} else {
|
||||
res.append(s);
|
||||
}
|
||||
}
|
||||
return res.toString();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@ public class Main {
|
||||
String test(String[] strings) {
|
||||
String res = "";
|
||||
for (String s : strings) {
|
||||
res <caret>+= s;
|
||||
res <caret>+= s + "\n";
|
||||
res += s;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,12 @@ public class Main {
|
||||
if (/*before*/!res/*within*/.isEmpty()) {
|
||||
res += ", ";
|
||||
}
|
||||
res = (res <caret>+ s);
|
||||
if (s.contains("'")) {
|
||||
res = (res <caret>+ '[' // bracket
|
||||
+ s + ']');
|
||||
} else {
|
||||
res = (res + s);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user