【发布时间】:2014-03-26 04:39:54
【问题描述】:
我有以下std::string:
<lots of text not including "label A" or "label B">
label A: 34
<lots of text not including "label A" or "label B">
label B: 45
<lots of text not including "label A" or "label B">
...
我想在所有出现的label A 或label B 之后提取单个整数,并将它们放在相应的vector<int> a, b 中。一种简单但不优雅的方法是使用 find("label A") 和 find("label B") 并解析先到者。有没有用 Spirit 简洁的表达方式?除了label A 或label B,您如何跳过所有内容?
【问题讨论】:
标签: c++ boost boost-spirit seek