C++ string,删除字符串中的首尾空格

    void EraseSpace(string &s)
    {
		//ch可换成其他字符
		const char ch = ' ';
        s.erase(s.find_last_not_of(" ") + 1);
        s.erase(0, s.find_first_not_of(" "));
    }

猜你喜欢

转载自blog.csdn.net/avaado/article/details/81128209
今日推荐