标签:android blog io ar os sp for on 2014
Cocos2d 中一些验证正则表达式:
邮箱:
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) regex pattern("([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)"); if (! std::regex_match(m_pRegEmail->getText(), pattern)){
return false; } #endif #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) std::regex_t match_regex; regcomp(&match_regex,"([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)",REG_EXTENDED); if (regexec(&match_regex, m_pRegEmail->getText(), 0, NULL, 0) != 0){ return false; } regfree(&match_regex); #endif
bool includeChinese(const char *str) { char c; while (1) { c = *str++; if (c == 0) break; // if (c & 0x80) // if (*str & 0x80) return true; } return false; }
标签:android blog io ar os sp for on 2014
原文地址:http://blog.csdn.net/jiuaiwo1314/article/details/41863677