Ai
1 Star 0 Fork 0

webturing/cplusplus

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
test.cpp 572 Bytes
一键复制 编辑 原始数据 按行查看 历史
webturing 提交于 2019-07-25 15:37 +08:00 . 1093 字符串处理
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
string s = "2019-07-25 14:45:23";
transform(s.begin(), s.end(), s.begin(), [](char c) -> char {
if (string("0123456789").find(c) == string::npos)
return ' ';
return c;
});
cout << s << endl;
int y, m, d, hh, mm, ss;
istringstream iss(s);
iss >> y >> m >> d >> hh >> mm >> ss;
cout << y << endl;
cout << m << endl;
cout << d << endl;
cout << hh << endl;
cout << mm << endl;
cout << ss << endl;
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/webturing/cplusplus.git
git@gitee.com:webturing/cplusplus.git
webturing
cplusplus
cplusplus
master

搜索帮助