c++ 判断字符串只包含字母、数字、汉字
bool StringUtils::CheckName(const char * iName){ bool result=false; if(strlen(iName)>62)return result;//长度不能超过62个字符 while(*iName) { if((*iName)&0x80){ //是汉字 result=true; iName++;//知道是汉字的话跳过一个字节检测 } else if((*iName>='a'&&*iName<='z'||*iName>='A'&&*iName<='Z')||((*iName)>='0'&&(*iName)<='9')) { result=true; } else{ result=false; break; } iName++; } return result; }