Tianchi  v0.0.2 build 20130701
C++ library for Qt with VC & mingW
静态 Public 成员函数 | 所有成员列表
TcChinese类 参考

汉语相关处理类 更多...

#include <tcchinese.h>

静态 Public 成员函数

static QString firstPinyins (const QString &HzString)
 
static QString toPinyin (const QString &Str, bool Tonality=false)
 
static QString toChars (const QString &Str, bool Tonality=false)
 

详细描述

汉语相关处理类

注解
此类仅限在 Windows 下有效,使用时需要在 .pro 文件中加上 LIB += -lole32

成员函数说明

static QString TcChinese::firstPinyins ( const QString &  HzString)
static

取得多个汉字的首字母

参数
[in]HzString汉字字符串
返回
每个汉字拼音的首字符
示例:
qDebug()<<TIANCHI::Chinese::firstPinyins(QS("中华人民共和国"));
> zhrmghg
qDebug()<<TIANCHI::Chinese::firstPinyins(QS("中华大地Qt论坛 - www.qtcn.org"));
> zhddlt
static QString TcChinese::toChars ( const QString &  Str,
bool  Tonality = false 
)
static

混合字符时,转换中不过滤英数符号等

参数
[in]Str汉字字符串
[in]Tonality音调不转换成拼音
返回
汉字的首字母
示例:
qDebug()<<TIANCHI::Chinese::toChars(QS("中华大地Qt论坛 - www.qtcn.org"), true);
> zhōnghuádàdìQtlùntán - www.qtcn.org
qDebug()<<TIANCHI::Chinese::toChars(QS("中华大地Qt论坛 - www.qtcn.org"));
> zhonghuadadiQtluntan - www.qtcn.org
static QString TcChinese::toPinyin ( const QString &  Str,
bool  Tonality = false 
)
static

取得多个汉字的全部拼音

参数
[in]Str汉字字符串
[in]Tonality音调不转换成拼音
返回
汉语拼音
示例:
含音调的输出
qDebug()<<TIANCHI::Chinese::toPinyin(QS("中华人民共和国"), true);
> zhōnghuárénmíngònghéguó
不含音调的输出
qDebug()<<TIANCHI::Chinese::toPinyin(QS("中华人民共和国"), false);
> zhonghuarenmingongheguo
qDebug()<<TIANCHI::Chinese::toPinyin(QS("中华大地Qt论坛 - www.qtcn.org"));
> zhonghuadadiluntan

该类的文档由以下文件生成: