C++::string、set中函数用法

1.string str

  s=str.find('x');//在字符串中查找

  if(s==s.npos)//没找到

     cout<<“not found"<<endl;

 str.insert(s.end(),a[i]+'0')//可以作为a2s函数,第一个参数填写为字符串末尾

-------------

2.set<string > s1

 if(s1.find(str)==s1.end())//没找到,没在set中存储过

  s1.insert(str)//不需要像string那样填写插入位置

 
 
 

版权声明:本文为HYbuery原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。