package cn.cslg.pas.service; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; /** * @author chenyu * @date 2023/9/1 */ @SpringBootTest public class test { @Test void test() { String text = "【請求項1】\n" + "複数の電源と;\n" + "各々が前記電源の1つに関連し、前記関連する電源の性能データを収集する複数の監視モジュールと;\n" + "各々が前記監視モジュールの1つに関連し、前記性能データを送信する複数の送信機と;\n" + "各々が前記送信機の1つに関連し、タイマーの初期化からの経過時間に応じて送信イベントを制御する複数のコントローラと\n" + "を具えていることを特徴とする分散型DC電力設備用監視システム。\n"; boolean result1 = text.contains("、"); boolean result2 = text.substring(0, text.indexOf("、")).contains("請求項"); boolean result3 = text.contains("、"); boolean result4 = text.contains("請求項"); if ((text.contains("、") && text.substring(0, text.indexOf("、")).contains("請求項")) || (!text.contains("、") && text.contains("請求項"))) { System.out.println("通过"); } // if ((strs[i].contains("、") && strs[i].substring(0, strs[i].indexOf("、")).contains("請求項")) || (!strs[i].contains("、") && strs[i].contains("請求項"))) { // // } } }