例如 "10km"
获取 "km"
string strLevel = "10km";
string::iterator iter=strLevel.begin();
string strUnit; //"km"
for(iter;iter!=strLevel.end(); ++iter)
{
if(!isdigit(*iter)) //不是数字
{
strUnit = strUnit + (*iter);
}
}
转载于:https://www.cnblogs.com/hiwoshixiaoyu/p/10035000.html