首页 > 其他 > 详细

string

时间:2018-08-24 11:22:19      阅读:128      评论:0      收藏:0      [点我收藏+]

string基操:

#include<string>

string a;

cin>>a;

长度的获取:

a.size();

获得第一个字符:

string:const_iterator it=s.begin();
count<<*it<<endl;

获得最后一个字符:

string:const_iterator it=s.end();
it--;
count<<*it<<endl;
倒置串:

reserve(s.begin(),s.end());

查找串:

s.find(s1);

有的话返回起始位置 没有则返回-1

 

string

原文:https://www.cnblogs.com/bhd123/p/9528705.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!