C++ Unicode检测中文
来源:互联网 发布:淘宝自定义区怎么设置 编辑:程序博客网 时间:2024/05/21 10:34
// 这个函数检测输入的Unicode字符串在首字母不是数字的前提下,是否是由字母、数字和汉字组成,不能包含ASCII码表的特殊字符(下划线和丨线除外)
bool VerifyAccountName(wstring wstrName){bool bFlag = false;do {if (wstrName[0] >= L'0' && wstrName[0] <= L'9')break;int nLen = wstrName.length();for (int i = 0; i < nLen; i++){// 数字以前的字符if (wstrName[i] >= 0 && wstrName[i] < 48){goto __ExitProc; }// 数字和大写字母之间的字符if (wstrName[i] > 57 && wstrName[i] < 65){goto __ExitProc; }// 大写和小写字母之间的字符if (wstrName[i] > 90 && wstrName[i] < 97){// 只可以使用下划线if (wstrName[i] != L'_'){goto __ExitProc; }elsecontinue;}if (wstrName[i] > 122 && wstrName[i] < 256){if (wstrName[i] != L'|'){goto __ExitProc; }elsecontinue;}// 判断下是不是中文,这里根据Unicode汉字编码表返回进行判断,这里要根据系统的内存布局来调整unsigned char* pCh = (unsigned char*)&wstrName[i];if (((*pCh >= 0) && (*pCh <= 0xff)) && (*(pCh + 1) >= 0x4e && *(pCh + 1) <= 0x95))continue;elsegoto __ExitProc; // 不是中文}bFlag = true;} while (false);__ExitProc:return bFlag;}
0 0
- C++ Unicode检测中文
- c#unicode转中文
- C++unicode中文显示
- objective-c unicode转中文
- objective-c Unicode转中文
- objective-c Unicode转中文
- objective-c Unicode转中文
- 检测unicode字符集(中文 日文 等其它)
- Objective-C Unicode 转换成中文
- Objective-C Unicode 转换成中文
- objective-c Unicode转中文 重写NSLog
- Objective-c unicode 转换成中文c代码
- c/c++ 中文字符串转Unicode和UTF8
- 用C语言实现中文到unicode码的转换
- 用C语言实现中文到unicode码的转换
- 用C语言实现中文到unicode码的转换
- 用C语言实现中文到unicode码的转换
- 用C语言实现中文到unicode码的转换
- MyEclipse6.5增加对JavaEE6的支持
- 少女火场持手电筒向楼下求救 被消防发现
- 学习网址
- JAVA GUI程序交互 示例
- JDK环境变量配置
- C++ Unicode检测中文
- selenium+Python获取弹出框内容的提醒
- hdu 2084 解题报告
- CENTOS中文乱码
- (三)os模块
- Android WebView使用Javascript详解
- java解析Json的两种方式
- SqlServer 错误:"SQL Server 无法生成 FRunCM 线程" -- 解决办法
- 《老罗Android》学习之GSON技术(三)