3日目 段階2 小澤
This commit is contained in:
@@ -24,16 +24,16 @@ public class StringCheck {
|
||||
|
||||
str = imputString();
|
||||
|
||||
boolean isEmpty = (str.length() == 0);
|
||||
boolean isTooLong = (str.length() > 140);
|
||||
// boolean isEmpty = (str.length() == 0);
|
||||
// boolean isTooLong = (str.length() > 140);
|
||||
|
||||
|
||||
if (isEmpty) {
|
||||
if (isEmptyInput(str)) {
|
||||
System.out.println(messages[1]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isTooLong) {
|
||||
if (isTooLongInput(str)) {
|
||||
System.out.println(messages[2]);
|
||||
continue;
|
||||
}
|
||||
@@ -51,5 +51,15 @@ public class StringCheck {
|
||||
String line = scanner.nextLine();
|
||||
return line.strip();
|
||||
}
|
||||
|
||||
public static boolean isEmptyInput(String text) {
|
||||
return text.length() == 0;
|
||||
|
||||
}
|
||||
|
||||
public static boolean isTooLongInput(String text) {
|
||||
return text.length() > 140;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user