1 Star 0 Fork 1

dhs347/cppstudy

forked from Huoty/cppstudy 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
join.cpp 593 Bytes
一键复制 编辑 原始数据 按行查看 历史
Huoty 提交于 2024-12-08 23:34 +08:00 . update at 20241208233432
/*
* Copyright (c) JoinQuant Development Team
* Author: Huayong Kuang <kuanghuayong@joinquant.com>
*/
#include <iostream>
#include <iterator>
#include <vector>
#include <sstream>
using namespace std;
string join(const vector<string>& vec, const char* delim)
{
ostringstream res;
copy(vec.begin(), vec.end(), ostream_iterator<string>(res, delim));
return res.str();
}
int main(void)
{
vector<string> v_str;
v_str.push_back("hello");
v_str.push_back("world");
v_str.push_back("!");
string ret = join(v_str, "|");
cout << ret << endl;
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/dhs347/cppstudy.git
git@gitee.com:dhs347/cppstudy.git
dhs347
cppstudy
cppstudy
master

搜索帮助