STL-String tips
1. 构造函数
substring constructor
Copies the portion of str that begins at the character position pos and spans len characters (or until the end of str, if either str is too short or if len is string::npos).
string (const string& str, size_t pos, size_t len = npos);
2. 成员函数
-
std::string::substr
Generate substring
Returns a newly constructed string object with its value initialized to a copy of a substring of this object.The substring is the portion of the object that starts at character position pos and spans len characters (or until the end of the string, whichever comes first).
string substr (size_t pos = 0, size_t len = npos) const;
- [std::string::insert](http://www.cplusplus.com/reference/string/string/insert/)
Inserts additional characters into the [string](http://www.cplusplus.com/string) right before the character indicated by *pos* (or *p*):
```c++
string& insert (size_t pos, size_t n, char c);
-
std::string::replace
Copies the portion of str that begins at the character position subpos and spans sublen characters (or until the end of str, if either str is too short or if sublen is string::npos).
string& replace (size_t pos, size_t len, const string& str,
size_t subpos, size_t sublen);