wörterspiel/Format.java gelöscht
parent
f8b7cf4c0b
commit
5f21856c35
|
@ -1,44 +0,0 @@
|
||||||
|
|
||||||
public class Format {
|
|
||||||
|
|
||||||
public static String padword(String word, int pad) {
|
|
||||||
|
|
||||||
String result = ">>"+word;
|
|
||||||
if (result.length() >= pad-2) {
|
|
||||||
result += "<<";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
while(result.length() <= pad-2) {
|
|
||||||
result += "-";
|
|
||||||
}
|
|
||||||
result += "<<";
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String midpadword(String word, int pad) {
|
|
||||||
|
|
||||||
String result = word;
|
|
||||||
if (result.length() >= pad-4) {
|
|
||||||
result =">>" + result + "<<";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
while(result.length() <= pad-4) {
|
|
||||||
result = "-" + result + "-";
|
|
||||||
}
|
|
||||||
result =">>" + result + "<<";
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void pad(int input) {
|
|
||||||
|
|
||||||
String result = "#";
|
|
||||||
|
|
||||||
while(result.length() < input) {
|
|
||||||
result += "#";
|
|
||||||
}
|
|
||||||
System.out.println(result);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue