「Kotlin」正規表現で先頭の文字列を指定する
サンプルコード
fun main() { val str = Regex("^ST.") println("STC".matches(str)); println("SZC".matches(str)); }
結果
true
false
Coding Changes the World
サンプルコード
fun main() { val str = Regex("^ST.") println("STC".matches(str)); println("SZC".matches(str)); }
結果
true
false