我想用 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 回答2k 阅读✓ 已解决
2 回答3.9k 阅读✓ 已解决
2 回答3.2k 阅读✓ 已解决
1 回答3.2k 阅读✓ 已解决
1 回答2.7k 阅读✓ 已解决
3 回答3.5k 阅读
1 回答2.7k 阅读✓ 已解决
不需要图书馆。迭代可以完成任务(如果它像您描述的那样简单)。
输出