Skip to content

Commit 04d0586

Browse files
authored
Merge pull request #29 from Hart87/master
Separate Line With A Decorator
2 parents f94d4d7 + ac708af commit 04d0586

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

text-io/src/main/java/org/beryx/textio/TextTerminal.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,20 @@ default void println(String message) {
177177
println();
178178
}
179179

180+
/**
181+
* Prints a decorated line separator with a character of choice determined by the String parameter.
182+
* the length parameter dictates how many characters the decorator should be.
183+
* the decorator does not need to be a single character ie : '*' ... it could also be ie '+++' if desired.
184+
*/
185+
default void separateLineWithDecorator(String s, int length) {
186+
String separator = "";
187+
for (int i = 0; i < length; i++){
188+
separator = separator + s;
189+
}
190+
print(separator);
191+
println();
192+
}
193+
180194
/**
181195
* Prints each message in the list, inserting the line separator string between messages.
182196
* No separator string is printed after the last message.

0 commit comments

Comments
 (0)