函数作用:删除字符串前面的全部空格或者制表符和最后的回车换行符
void stripWhiteSpace (string &str)
{
if (str == "")
{
return;
}
string::iterator cur_it;
cur_it = str.begin();
while (cur_it != str.end())
{
if (((*cur_it) != '\t') && ((*cur_it) != ' '))
{
break;
}
else
{
cur_it = str.erase (cur_it);
}
}
cur_it = str.begin();
while (cur_it != str.end())
{
if ((*cur_it) == '\n')
{
cur_it = str.erase (cur_it);
}
else
{
cur_it++;
}
}
}