50 lines
1.3 KiB
Java
50 lines
1.3 KiB
Java
|
|
public class StringCheck {
|
|
|
|
public static void main(String[] args) {
|
|
// TODO 自動生成されたメソッド・スタブ
|
|
|
|
String[] name = {"いまなにしてる?", "何も入力されていません", "投稿文が長すぎます","↓↓↓↓↓↓ 投稿されました ↓↓↓↓↓↓"};
|
|
|
|
String str;
|
|
str = ("こんにちはこんばんはこんにちはこんばんはこんにちはこんばんはこんにちはこんばんはこんにちはこんばんはこんにちはこんばんはこんにちはこんばんはこんにちはこんばんはこんにちはこんばんはこんにちはこんばんはこんにちはこんばんはこんにちはこんばんはこんにちはこんばんはこんにちはこんばんはこんにちはこんばんは" );
|
|
|
|
//テスト
|
|
/*for (String stra : name ) {
|
|
System.out.println(stra);
|
|
}
|
|
*/
|
|
|
|
while (true) {
|
|
|
|
System.out.println(name[0]);
|
|
|
|
if (str.length() == 0) {
|
|
System.out.println(name[1]);
|
|
} else if (str.length() > 141) {
|
|
System.out.println(name[2]);
|
|
} else {
|
|
System.out.println(str);
|
|
|
|
System.out.println(" ");
|
|
|
|
System.out.println(name[3]);
|
|
|
|
|
|
System.out.println(140 - str.length());
|
|
|
|
//0を超える文字数
|
|
System.out.println(0 == str.length());
|
|
|
|
//140文字未満
|
|
System.out.println(str.length() < 141);
|
|
|
|
|
|
}
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
}
|