Splitted print class into printUnformated and printFormated.
And fixed errors in print Unformated
This commit is contained in:
parent
5020d4552a
commit
a65f1192a2
|
@ -29,7 +29,7 @@ public class TextOutput {
|
||||||
int letterLenght = letters.length;
|
int letterLenght = letters.length;
|
||||||
int lettersPrinted = 0;
|
int lettersPrinted = 0;
|
||||||
do {
|
do {
|
||||||
System.out.println();
|
//System.out.println();
|
||||||
currentLength = 0;
|
currentLength = 0;
|
||||||
for (int i = 0; i < columnWidth; i++) {
|
for (int i = 0; i < columnWidth; i++) {
|
||||||
if (letterLenght > 0) {
|
if (letterLenght > 0) {
|
||||||
|
@ -39,8 +39,11 @@ public class TextOutput {
|
||||||
currentLength++;
|
currentLength++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!(letterLenght == 0)){
|
||||||
|
System.out.println();
|
||||||
}
|
}
|
||||||
while (letterLenght > columnWidth);
|
}
|
||||||
|
while (letterLenght >= columnWidth);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -50,9 +53,10 @@ public class TextOutput {
|
||||||
}
|
}
|
||||||
System.out.print(word + " ");
|
System.out.print(word + " ");
|
||||||
currentLength += word.length() + 1;
|
currentLength += word.length() + 1;
|
||||||
if(words.length == word
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
System.out.println(); //added
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void formatRaw() {
|
public void formatRaw() {
|
||||||
|
|
|
@ -17,9 +17,10 @@ class TextOutputTest {
|
||||||
textOutput.formatFix(9);
|
textOutput.formatFix(9);
|
||||||
//textOutput.formatRaw();
|
//textOutput.formatRaw();
|
||||||
text = new ArrayList<>();
|
text = new ArrayList<>();
|
||||||
text.add("1234 12345");
|
text.add("123456789");
|
||||||
text.add("1234");
|
text.add("1234");
|
||||||
text.add("12 12 12");
|
text.add("12 12 12");
|
||||||
|
text.add("1eeeeeee8597389751");
|
||||||
text.add("TextTextTextTextTextTextTextTextTextTextTextTextTextText TextTextTextTextTextTextTextTextTextTextTextText TextTextText");
|
text.add("TextTextTextTextTextTextTextTextTextTextTextTextTextText TextTextTextTextTextTextTextTextTextTextTextText TextTextText");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue