2日目 段階1 小澤
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package stringCheck;
|
||||
import java.util.Scanner;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class StringCheck {
|
||||
public static void main(String[] args) {
|
||||
@@ -10,26 +10,31 @@ public class StringCheck {
|
||||
comment[2] = "投稿文が長すぎます";
|
||||
comment[3] = "\"↓↓↓↓↓↓ 投稿されました ↓↓↓↓↓↓\"";
|
||||
|
||||
for(String testComm : comment) {
|
||||
System.out.println(testComm);
|
||||
}
|
||||
|
||||
|
||||
while(true) {
|
||||
|
||||
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);
|
||||
//
|
||||
// System.out.println(str.length() == 0);
|
||||
// System.out.println(str.length() > 140);
|
||||
//
|
||||
// System.out.println(140-str.length());
|
||||
|
||||
}
|
||||
|
||||
|
||||
boolean isStr0 = str.length() == 0;
|
||||
boolean isStr140 = str.length() > 140;
|
||||
System.out.println(isStr0);
|
||||
System.out.println(isStr140);
|
||||
|
||||
System.out.println(140-str.length());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user