Compare commits
5 Commits
main
...
0191dad61b
| Author | SHA1 | Date | |
|---|---|---|---|
| 0191dad61b | |||
| 0ea87e48f0 | |||
| 199b61f39d | |||
| aa756e3b97 | |||
| 1ced99f389 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -24,3 +24,4 @@
|
|||||||
hs_err_pid*
|
hs_err_pid*
|
||||||
replay_pid*
|
replay_pid*
|
||||||
|
|
||||||
|
/.metadata/
|
||||||
|
|||||||
34
Exercises/src/day_1/StringCheck.java
Normal file
34
Exercises/src/day_1/StringCheck.java
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package day_1;
|
||||||
|
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
public class StringCheck {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// TODO 自動生成されたメソッド・スタブ
|
||||||
|
String[] messages = { "いまなにしてる", "何も入力されていません", "投稿文が長すぎます", "↓↓↓↓↓↓ 投稿されました ↓↓↓↓↓↓" };
|
||||||
|
|
||||||
|
Scanner scan = new Scanner(System.in);
|
||||||
|
System.out.println(messages[0]);
|
||||||
|
// 1 မျက်နှာစာ ဖတ်ရှုပြီး ရှေ့နောက် Space များကို ဖြတ်တောက်ခြင်း
|
||||||
|
String str = scan.nextLine().trim();
|
||||||
|
|
||||||
|
// အလုပ်လုပ်ပုံ စစ်ဆေးရန်အတွက် str ၏ ပါဝင်မှုကို ပြသခြင်း
|
||||||
|
System.out.println("入力値: [" + str + "]");
|
||||||
|
|
||||||
|
//問題3
|
||||||
|
boolean isEmpty = (str.length() == 0); // empty ckeck空文字判定:str の文字数が 0 かどうか
|
||||||
|
boolean isTooLong = (str.length() > 140); // limit spelling str の文字数が 140 を超えるかどうか
|
||||||
|
int remainingLength = 140 - str.length(); //残り入力可能文字数(140 - 文字数)
|
||||||
|
|
||||||
|
//空行を1行表示する (fill the enter)
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
// take out arrage string number 2
|
||||||
|
System.out.println(messages[3]);
|
||||||
|
|
||||||
|
// print input string
|
||||||
|
System.out.println(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user