首页 > 解决方案 > 具有多个空格的增强拆分功能

问题描述

我正在使用 boost 来拆分字符串

 boost::split(vectorStrSplitData, stdstrTxt, boost::is_any_of(" "), boost::token_compress_off);

当我使用这个字符串时,我在数字后添加多个空格时,我希望包含拆分字符串的向量的大小增加。

std::string str = "Number         ";

第一个向量元素是我所期望的,但没有空格。预期输出为:

{"Number", " ", " ", " " , " "} 

我试图查询空间,但没有得到任何结果。

if (isspace(chr))
    std::cout << "Is Space";

标签: c++boostsplit

解决方案


推荐阅读