編集の要約なし |
編集の要約なし |
||
(同じ利用者による、間の3版が非表示) | |||
1行目: | 1行目: | ||
"[[String]]".matches [https://docs.oracle.com/javase/jp/8/docs/api/java/lang/String.html#matches-java.lang.String-] | "[[String]]".matches [https://docs.oracle.com/javase/jp/8/docs/api/java/lang/String.html#matches-java.lang.String-] | ||
[[正規表現]]を利用して適切な文字列かどうか真偽する。ユーザによる入力データが適切かどうかの判断などに利用できる。 | |||
String s1 = "Java and Python and C++."; | String s1 = "Java and Python and C++."; | ||
8行目: | 8行目: | ||
} | } | ||
//endsWith(), | //endsWith(), startsWithの代用 | ||
s1.matches("Ma.*"); | s1.matches("Ma.*"); | ||
s1.matches(.*ful"); | s1.matches(.*ful"); |