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