判断输入类型

int GetInputStyle()
{
	if ("0x" == m_Str.substr(0,2))
		return HexInput;
	boost::regex lRe("[2-9]");
	boost::match_results<std::string::const_iterator> what; 
	bool lSearchResult = boost::regex_search(m_Str.begin(), m_Str.end(), lRe);
	if(false == lSearchResult)
	{
		lRe = "[0-1]";
		lSearchResult = boost::regex_search(m_Str.begin(), m_Str.end(), lRe);
		if(true == lSearchResult)
			return BinaryInput;
	}
	return ErrorInput;
}

  

posted @ 2012-10-06 11:05  hailong  阅读(235)  评论(0编辑  收藏  举报