編集の要約なし |
編集の要約なし |
||
| 7行目: | 7行目: | ||
System.out.println("ture"); | System.out.println("ture"); | ||
} | } | ||
//endsWith(), startsWithの代わりに利用する | |||
s1.matches("Ma.*"); | |||
s1.matches(.*ful"); | |||
編集の要約なし |
編集の要約なし |
||
| 7行目: | 7行目: | ||
System.out.println("ture"); | System.out.println("ture"); | ||
} | } | ||
//endsWith(), startsWithの代わりに利用する | |||
s1.matches("Ma.*"); | |||
s1.matches(.*ful"); | |||
正規表現を利用して指定文字列と一致するか真偽します。
String s1 = "Java and Python and C++.";
if (s1.matches("^[Jj]ava.*")) {
System.out.println("ture");
}
//endsWith(), startsWithの代わりに利用する
s1.matches("Ma.*");
s1.matches(.*ful");