From 214745d3489d50ca889989d1e8bdd152dd500d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B9=B3=E5=B1=B1=E3=80=80=E7=B4=97=E5=B8=86?= <26-s-hirayama-stellatecnica@it-college.co.jp> Date: Fri, 9 Oct 2026 17:26:17 +0900 Subject: [PATCH] =?UTF-8?q?3=E6=97=A5=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- StringCheck.java | 68 +++++++++++++++++++++++++++++++++++ StringCheck20261009_平山.java | 68 +++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 StringCheck.java create mode 100644 StringCheck20261009_平山.java diff --git a/StringCheck.java b/StringCheck.java new file mode 100644 index 0000000..6dd6290 --- /dev/null +++ b/StringCheck.java @@ -0,0 +1,68 @@ + +public class StringCheck { + + public static void main(String[] args) { + // TODO 自動生成されたメソッド・スタブ + + String[] name = {"いまなにしてる?", "何も入力されていません", "投稿文が長すぎます","↓↓↓↓↓↓ 投稿されました ↓↓↓↓↓↓"}; + + String str; + + str = ("  gagaga" ); + String stripped = str.strip(); + //テスト + /*for (String stra : name ) { + System.out.println(stra); + } + */ + + while (true) { + + System.out.println(name[0]); + + if (stripped.length() == 0) { + + System.out.println(name[1]); + + } else if (stripped.length() > 140) { + + System.out.println(name[2]); + + } else { + System.out.println(stripped); + + break; + }} + System.out.println(" "); + + System.out.println(name[3]); + + System.out.println(stripped); + + System.out.println(140 - stripped.length()); + + //0を超える文字数 + System.out.println(0 <= stripped.length()); + + //140文字未満 + System.out.println(stripped.length() <= 140); + } + + //空白除去 + public static String inputStrng(String str) { + String stripped; + return stripped = str.strip(); + } + + //空文字判定 + //public static String isEmptyInput() { + + + + + //文字数超過判定 + //public static String isTooLongInput() { + + + +} diff --git a/StringCheck20261009_平山.java b/StringCheck20261009_平山.java new file mode 100644 index 0000000..6dd6290 --- /dev/null +++ b/StringCheck20261009_平山.java @@ -0,0 +1,68 @@ + +public class StringCheck { + + public static void main(String[] args) { + // TODO 自動生成されたメソッド・スタブ + + String[] name = {"いまなにしてる?", "何も入力されていません", "投稿文が長すぎます","↓↓↓↓↓↓ 投稿されました ↓↓↓↓↓↓"}; + + String str; + + str = ("  gagaga" ); + String stripped = str.strip(); + //テスト + /*for (String stra : name ) { + System.out.println(stra); + } + */ + + while (true) { + + System.out.println(name[0]); + + if (stripped.length() == 0) { + + System.out.println(name[1]); + + } else if (stripped.length() > 140) { + + System.out.println(name[2]); + + } else { + System.out.println(stripped); + + break; + }} + System.out.println(" "); + + System.out.println(name[3]); + + System.out.println(stripped); + + System.out.println(140 - stripped.length()); + + //0を超える文字数 + System.out.println(0 <= stripped.length()); + + //140文字未満 + System.out.println(stripped.length() <= 140); + } + + //空白除去 + public static String inputStrng(String str) { + String stripped; + return stripped = str.strip(); + } + + //空文字判定 + //public static String isEmptyInput() { + + + + + //文字数超過判定 + //public static String isTooLongInput() { + + + +}