1 Star 0 Fork 1

dhs347/cppstudy

forked from Huoty/cppstudy 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
pathjoin.cpp 640 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>
using namespace std;
string path_join(const string &path, const string &subpath) {
char sep = '/';
string t_path = path.back() == sep ? path.substr(0, path.length() - 1) : path;
string t_subpath = subpath.front() == sep ? subpath.substr(1) : subpath;
return t_path + "/" + t_subpath;
}
int main(void)
{
cout << path_join("/dev/shm/l1tick/", "2021-12-06") << endl;
cout << path_join("/home/", "huayong/test") << endl;
cout << path_join("/home/", "/huayong/temp") << endl;
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/dhs347/cppstudy.git
git@gitee.com:dhs347/cppstudy.git
dhs347
cppstudy
cppstudy
master

搜索帮助