Skip to content

Commit ff5faa2

Browse files
add methods repeat and replaceTabsWithSpaces
for consistent usage across the project
1 parent e7bf427 commit ff5faa2

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

sqldev/src/main/java/org/utplsql/sqldev/model/StringTools.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ public static String getCSV(List<String> list, String indent) {
4040
}
4141

4242
public static String getCSV(List<String> list, int indentSpaces) {
43-
final String indent = String.join("", Collections.nCopies(indentSpaces, " "));
44-
return getCSV(list, indent);
43+
return getCSV(list, repeat(" ", indentSpaces));
4544
}
4645

4746
public static String getSimpleCSV(List<String> list) {
@@ -55,4 +54,12 @@ public static String getSimpleCSV(List<String> list) {
5554
return sb.toString();
5655
}
5756

57+
public static String repeat(String s, int times) {
58+
return String.join("", Collections.nCopies(times, s));
59+
}
60+
61+
public static String replaceTabsWithSpaces(final CharSequence input, int indentSpaces) {
62+
final String spaces = StringTools.repeat(" ", indentSpaces);
63+
return input.toString().replace("\t", spaces);
64+
}
5865
}

0 commit comments

Comments
 (0)