//字符串长度
int calcCharCount(const char *pszText)
{
int n = 0;
char ch = 0;
while ((ch = *pszText))
{
CC_BREAK_IF(! ch);
if ((0x80 & ch) == 0x00) {
n++;
} else if (0x80 != (0xC0 & ch)) {
n+=2;
}
++pszText;
}
return n;
}
//包含特殊字符
bool checkSpecialCharacter(string text)
{
char temp;
for (int i =0; i <text.length(); i++) {
temp = text[i];
if ((temp >= 0 && temp <= 47) || (temp >= 58 && temp<= 64) || (temp >=91 && temp <= 96) || (temp >= 123 && temp <= 223 )) {
CCLog("用户名称包含特殊字符");
return true;
}
}
return false;
}