为了将字符串拆分为向量,我使用
std::vector<std::string> v;
boost::split(v, input, boost::is_any_of("|"));
Run Code Online (Sandbox Code Playgroud)
Boost或STL中是否存在执行此操作相反功能的函数,即形式为join的函数
join(v, output, "|")
Run Code Online (Sandbox Code Playgroud)
std::vector<std::string> v = {"Hello", "world"};
const std::string separator = " ";
std::string s = boost::join(v, separator);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
65 次 |
| 最近记录: |