Operation of C++_Sting

[1] string substring:
str.substr( 0 ,i_start);//Take i_start characters starting from subscript 0
cout<<x.substr( 5 )<<endl; //Intercept x[5] to the end, ie npos. The overload prototype is string substr(_off,_count=npos)  

[2] atoi function converts a string to an integer

 char a[] = "-100" ;
  char b[] = "123" ;
  int c ;
  c = atoi( a ) + atoi( b ) ;

[3] Erase parameter: start position, delete length.

 strT.erase(pos,2)

[4]string.find()

https://blog.csdn.net/shujh_sysu/article/details/52026108




Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324836114&siteId=291194637