In Matlab r2010b, how to find that string contains japanese character?

3 ビュー (過去 30 日間)
Ami Shah
Ami Shah 2016 年 1 月 13 日
コメント済み: Ami Shah 2016 年 1 月 18 日
In Matlab R2010b, is there any function to know that string contain Japanese characters? or is there any function that check the given char is Japanese character or not?
for example,
1)abc - it should return false
2)aあc - it should return true
3)漢字 - it should return true
if there is no direct method in matlab, then how can I check by any other way?

回答 (1 件)

C.J. Harris
C.J. Harris 2016 年 1 月 13 日
Depends on what you define as Japanese. The Hiragana characters have an Unicode range from 12352-12447, while the Katagana characters have a Unicode range from 12448-12543. Therefore, to check for both:
lLowerRange = 12352;
lUpperRange = 12543;
A = 'aあc';
B = 'abc';
any(double(A)>=lLowerRange & double(A)<=lUpperRange)
ans =
1
any(double(B)>=lLowerRange & double(B)<=lUpperRange)
ans =
0
  3 件のコメント
C.J. Harris
C.J. Harris 2016 年 1 月 14 日
See the link for a full range of unicode characters:
Ami Shah
Ami Shah 2016 年 1 月 18 日
Thanks C.J.Harris

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by