正規表現の文字判定です。
カタカナを判定する方法のサンプルです。
Validation.kt
fun isKatakana(inputText: String): Boolean {
val regex = Regex("^[\u30A0-\u30FF ]++\$")
return inputText.matches(regex)
}
個人的に正規表現があまり得意ではなく、すぐ忘れ使う時にまた調べ直したりするので、理解していきたいです。
Go to list of users who liked
正規表現の文字判定です。
カタカナを判定する方法のサンプルです。
fun isKatakana(inputText: String): Boolean {
val regex = Regex("^[\u30A0-\u30FF ]++\$")
return inputText.matches(regex)
}
個人的に正規表現があまり得意ではなく、すぐ忘れ使う時にまた調べ直したりするので、理解していきたいです。
Register as a new user and use Qiita more conveniently
Go to list of users who liked