Day 2 Stept 3
This commit is contained in:
@@ -14,13 +14,18 @@ public class StringCheck {
|
|||||||
// 段階1: 無限ループ化
|
// 段階1: 無限ループ化
|
||||||
while (true) {
|
while (true) {
|
||||||
System.out.println(messages[0]);
|
System.out.println(messages[0]);
|
||||||
str = scan.nextLine().trim();
|
str = scan.nextLine();
|
||||||
|
//str = scan.nextLine().trim();
|
||||||
|
str = str.replaceAll("[\\s ]", "");
|
||||||
|
//String str1 = str.replaceAll("[ ]", "");
|
||||||
|
|
||||||
//System.out.println("あなたの入力は: [" + str + "]");
|
//System.out.println("あなたの入力は: [" + str + "]");
|
||||||
|
|
||||||
|
|
||||||
//2段階のif
|
//2段階のif
|
||||||
boolean isEmpty = str.isEmpty();
|
boolean isEmpty = str.isEmpty();
|
||||||
boolean isTooLong = str.length() > 140;
|
boolean isTooLong = str.length() > 140;
|
||||||
|
|
||||||
if(isEmpty) {
|
if(isEmpty) {
|
||||||
System.out.println(messages[1]);
|
System.out.println(messages[1]);
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user