0
0

ICU4Jの変換が強力すぎるので文字種を規制したい

Last updated at Posted at 2023-12-06

とどのつまり…

UnicodeSetを使って正規表現で文字種を規制してFilterに設定すべし

    // カタカナとか巻き込まれて半角になると困る!全角英数字だけ半角にさせてくれ!!
    Transliterator transliterator = Transliterator.getInstance("Fullwidth-Halfwidth");
    transliterator.setFilter(new UnicodeSet("[0-9a-zA-Z]").freeze());
    return transliterator.transliterate("FULL width text");
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