判断输入类型

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;
}

  

原文地址:https://www.cnblogs.com/xiangshancuizhu/p/2712830.html