C++学习笔记 string类
初始化string

string类的运算符:
注意度量长度的 string类方法, .length(), 不能使用用strlen,错误:不能从 ‘std::string’ 转换到 ‘const char*’,

成员函数:带'.'的
s = "Say this shortly, say this softly."
取子串 s1.substr(4,4) : "this"
查找(首次出现的位置) :s.find("this"): 4
查找(末次出现的位置) :s.rfind("this"): 22
插入:s.insert( i ,s2) : 在第i个位置插入s2
替换:s.replace(pos, n, s2) :把从pos开始的n个字符用s2替换掉(删除,插入)
交换:s1.swap(s2) : 将s1与s2的内容交换