String 使用boost::iter_split拆分时如何避免空令牌?
我的代码使用boost将字符串拆分为令牌:String 使用boost::iter_split拆分时如何避免空令牌?,string,boost,String,Boost,我的代码使用boost将字符串拆分为令牌: boost::algorithm::iter_split( result_vector, input, boost::algorithm::first_finder(delimiter)); 改变这一点的最佳和最优雅的方法是什么,以使结果不包含空标记 例如,我的输入可能是: foo.bar.baz. 其中,是分隔符。只需在结果向量上使用remove\u if,并使用lambda函数测试字符串 然后调整向量大小 result_vector.re
boost::algorithm::iter_split(
result_vector, input, boost::algorithm::first_finder(delimiter));
改变这一点的最佳和最优雅的方法是什么,以使结果不包含空标记
例如,我的输入可能是:
foo.bar.baz.
其中,
是分隔符。只需在结果向量上使用remove\u if,并使用lambda函数测试字符串
然后调整向量大小
result_vector.resize(newEndIt - result_vector.begin());
为了提高你的文章质量,请包括你的文章将如何/为什么解决这个问题。
result_vector.resize(newEndIt - result_vector.begin());