How to classify Japanese characters as either kanji or kana?

后端 未结 5 921
既然无缘
既然无缘 2021-02-01 22:57

Given the text below, how can I classify each character as kana or kanji?

誰か確認上記これらのフ

To get some thing like this

誰 - kanji
か - kana
確 - kanji
認          


        
5条回答
  •  攒了一身酷
    2021-02-01 23:41

    Use a table like this one to determine which unicode values are used for katakana and kanji, then you can simply cast the character to an int and check where it belongs, something like

    int val = (int)て;
    if (val >= 0x3040 && val <= 0x309f)
      return KATAKANA
    ..
    

提交回复
热议问题