C++ 检查unicode字符是否为全角 [英] C++ check if unicode character is full width

查看:87
本文介绍了C++ 检查unicode字符是否为全角的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检查一个 unicode 字符是否为全角?

How to check if a unicode character is full width?

我使用 Win32/MFC

I use Win32 / MFC

例如是全宽,A不是全宽,F是全宽,F> 不是全宽.

For example, is full width, A is not full width, is full width, F is not full width.

推荐答案

您需要的是检索东亚宽度 字符.您可以通过解析 Unicode 字符数据库中的 EastAsianWidth.txt 文件来实现.我找不到返回此信息的 Win32 API,但在 Python 中,例如,您可以使用 unicodedata.east_asian_width(unichr).

What you need is to retrieve the East Asian Width of the character. You can do it by parsing the EastAsianWidth.txt file from the Unicode Character Database. I could not find a Win32 API that returns this info, but in Python, for example, you can use unicodedata.east_asian_width(unichr).

有关问题的背景和更多信息,请参阅附件 #11.

See the Annex #11 for the background of the problem and more information.

这篇关于C++ 检查unicode字符是否为全角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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