我想用 C++ 编写一些标记字符串的东西。为了清楚起见,请考虑以下字符串:
add string "this is a string with spaces!"
这必须按如下方式拆分:
add
string
this is a string with spaces!
是否有快速且基于标准库的方法?
原文由 the_candyman 发布,翻译遵循 CC BY-SA 4.0 许可协议
我想用 C++ 编写一些标记字符串的东西。为了清楚起见,请考虑以下字符串:
add string "this is a string with spaces!"
这必须按如下方式拆分:
add
string
this is a string with spaces!
是否有快速且基于标准库的方法?
原文由 the_candyman 发布,翻译遵循 CC BY-SA 4.0 许可协议
3 回答1.3k 阅读✓ 已解决
1 回答1.1k 阅读✓ 已解决
4 回答840 阅读
1 回答915 阅读
1 回答949 阅读
1 回答715 阅读
1 回答816 阅读
不需要图书馆。迭代可以完成任务(如果它像您描述的那样简单)。
输出