您当前的位置: 首页 >  c++

惊鸿一博

暂无认证

  • 2浏览

    0关注

    535博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

c++_string与double/int互转

惊鸿一博 发布时间:2021-09-23 15:07:34 ,浏览量:2

1. 字符串string转数值double/int等 使用 stringstream
stringstream ss;
string timeStr = s0.substr(0, 16);
ss > t;
使用atof atoi
string myStr = "123.332";
double myNum = atof(myStr.c_str());

string myStr = "123";
int myNum = atoi(myStr.c_str());

关注
打赏
1663399408
查看更多评论
立即登录/注册

微信扫码登录

0.0362s