c++ string函数合集

  1. s.substr(x,len) 在s中取出从x位置开始,长度为len的字符串,并返回string类型的字符串。

  2. s.find(a) 在s中查找字符串a,并返回起始下标(从0开始),若不存在,返回1844674407370955161,即(1999999999999999)16.

  3. s.length() 求s的长度(从0开始)。

  4. s[1] 字符串s的第2个字符,相当于数组(后来因为有了substr,就不用了)。

原文地址:https://www.cnblogs.com/lipeiyi520/p/10414227.html