0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Android 正規表現 カタカナ判定方法

0
Posted at

正規表現の文字判定です。
カタカナを判定する方法のサンプルです。

Validation.kt
fun isKatakana(inputText: String): Boolean {
    val regex = Regex("^[\u30A0-\u30FF ]++\$")
    return inputText.matches(regex)
}

個人的に正規表現があまり得意ではなく、すぐ忘れ使う時にまた調べ直したりするので、理解していきたいです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?