如何检查字符串中的字符是否为日语? [英] How do I check if the character in a string is Japanese ?

查看:108
本文介绍了如何检查字符串中的字符是否为日语?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!



请在下面的问题上建议。



我有unicode MFC应用程序。



如果CString包含任何日文文本,那么我不需要在窗口的标题上显示。

我如何识别这个字符串是否包含日语字符?



CString s = _T(春日井隆夫);



谢谢

Sam。

Hi!

Please suggest on below issue.

I have unicode MFC application.

If CString contains any japanese text then i need not to show on title of the window.
How can i recongnize is this string contains japanese character ?

CString s = _T(" 春日井 隆夫");

Thanks
Sam.

推荐答案

我不懂语言,但我对日语书写系统有所了解。没有一般的日语Unicode子集,但平假名片假名假名及其变体(补充,扩展和半宽形式)。请参阅:

http://www.unicode.org/charts/ [ ^ ],

http://en.wikipedia.org/wiki/Hiragana [ ^ ],

http:// en.wikipedia.org/wiki/Katakana [ ^ ],

http://en.wikipedia.org/wiki/Kana [ ^ ]。



使用这些文章(特别是来自 http://Unicode.org ,Wikipedia获取一般信息),以代码点的形式识别Unicode子集范围,将此数据放入您的代码并编写你的方法基于这些数据。这很简单。



我建议不要写一个布尔函数(日语或非日语),而是一个返回一些分类器的函数,显示日语写作一个给定角色所属的系统。引入一个枚举类型来描述它。



-SA
I don''t know the language, but I know a bit about Japanese writing systems. There is no a general "Japanese" Unicode subset, but there are separate Unicode subsets for Hiragana, Katakana, Kana and their variants (supplements, extensions and half-width forms). Please see:
http://www.unicode.org/charts/[^],
http://en.wikipedia.org/wiki/Hiragana[^],
http://en.wikipedia.org/wiki/Katakana[^],
http://en.wikipedia.org/wiki/Kana[^].

Using these articles (especially from http://Unicode.org, Wikipedia for general information), recognize the Unicode subset in the form of code point ranges, put this data in your code and write then your method(s) bases on this data. It''s quite simple.

I would suggest to wrote not a Boolean function (Japanese or not), but instead, a function returning some classifier showing what Japanese writing system a given character belongs to. Introduce an enumeration type to describe it.

—SA


这篇关于如何检查字符串中的字符是否为日语?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆