2日目 段階3 小澤
This commit is contained in:
@@ -10,31 +10,36 @@ public class StringCheck {
|
|||||||
comment[2] = "投稿文が長すぎます";
|
comment[2] = "投稿文が長すぎます";
|
||||||
comment[3] = "\"↓↓↓↓↓↓ 投稿されました ↓↓↓↓↓↓\"";
|
comment[3] = "\"↓↓↓↓↓↓ 投稿されました ↓↓↓↓↓↓\"";
|
||||||
|
|
||||||
for(String testComm : comment) {
|
// for (String testComm : comment) {
|
||||||
System.out.println(testComm);
|
// System.out.println(testComm);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
System.out.println(comment[0]);
|
||||||
|
Scanner scanner = new Scanner(System.in);
|
||||||
|
String text = scanner.nextLine();
|
||||||
|
String str = text.strip();
|
||||||
|
|
||||||
while(true) {
|
// System.out.println(str.length() == 0);
|
||||||
|
// System.out.println(str.length() > 140);
|
||||||
System.out.println(comment[0]);
|
|
||||||
Scanner scanner = new Scanner(System.in);
|
|
||||||
String text = scanner.next();
|
|
||||||
String str = text.strip();
|
|
||||||
System.out.println("\n" + comment[3]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// System.out.println(str);
|
|
||||||
//
|
//
|
||||||
// System.out.println(str.length() == 0);
|
// System.out.println(140 - str.length());
|
||||||
// System.out.println(str.length() > 140);
|
|
||||||
//
|
|
||||||
// System.out.println(140-str.length());
|
|
||||||
|
|
||||||
|
if(str.length() < 1) {
|
||||||
|
System.out.println("何も入力されていません");
|
||||||
|
continue;
|
||||||
|
}else if(str.length() > 140){
|
||||||
|
System.out.println("投稿文が長すぎます");
|
||||||
|
continue;
|
||||||
|
}else {
|
||||||
|
System.out.println("\n" + comment[3]);
|
||||||
|
System.out.println(str);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user