| string (1) | 
string& append (const string& str);  | 
			
|---|---|
| substring (2) | 
string& append (const string& str, size_t subpos, size_t sublen);  | 
			
| c-string (3) | 
string& append (const char* s);  | 
			
| buffer (4) | 
string& append (const char* s, size_t n);  | 
			
| fill (5) | 
string& append (size_t n, char c);  | 
			
| range (6) | 
template <class InputIterator> string& append (InputIterator first, InputIterator last);  | 
			
| initializer list(7) | 
string& append (initializer_list<char> il);  | 
			
	Output:
	
		
			
				
	
Writing 10 dots here: .......... and then 5 more.....  | 
				
std::string::push_back
void push_back (char c);
		Append character to string
	
Appends character c to the end of the string, increasing its length by one.
	This example reads an entire file character by character, appending each character to a string object using push_back.
std::string::insert
		--- 通过给定 pos,可指定从pos开始插入 len个字符。
	
	| string (1) | 
string& insert (size_t pos, const string& str);  | 
			
|---|---|
| substring (2) | 
string& insert (size_t pos, const string& str, size_t subpos, size_t sublen);  | 
			
| c-string (3) | 
string& insert (size_t pos, const char* s);  | 
			
| buffer (4) | 
string& insert (size_t pos, const char* s, size_t n);  | 
			
| fill (5) | 
string& insert (size_t pos, size_t n, char c); iterator insert (const_iterator p, size_t n, char c);  | 
			
| single character (6) | 
iterator insert (const_iterator p, char c);  | 
			
| range (7) | 
template <class InputIterator> iterator insert (iterator p, InputIterator first, InputIterator last);  | 
			
| initializer list (8) | 
string& insert (const_iterator p, initializer_list<char> il);  | 
			
std::string::erase
		--- 通过给定 pos,可指定从pos开始擦除 len个字符。
	
	
					
  | 
				
					 | 
			
|---|
std::string::replace
		--- 通过给定 pos,可指定从pos开始替换 len个字符。
	
	| string (1) | 
string& replace (size_t pos, size_t len, const string& str); string& replace (const_iterator i1, const_iterator i2, const string& str);  | 
			
|---|---|
| substring (2) | 
string& replace (size_t pos,        size_t len,        const string& str,
                 size_t subpos, size_t sublen);
				 | 
			
| c-string (3) | 
string& replace (size_t pos, size_t len, const char* s); string& replace (const_iterator i1, const_iterator i2, const char* s);  | 
			
| buffer (4) | 
string& replace (size_t pos, size_t len, const char* s, size_t n); string& replace (const_iterator i1, const_iterator i2, const char* s, size_t n);  | 
			
| fill (5) | 
string& replace (size_t pos, size_t len, size_t n, char c); string& replace (const_iterator i1, const_iterator i2, size_t n, char c);  | 
			
| range (6) | 
template <class InputIterator>
  string& replace (const_iterator i1, const_iterator i2,
                   InputIterator first, InputIterator last);
				 | 
			
| initializer list (7) | 
string& replace (const_iterator i1, const_iterator i2, initializer_list<char> il);  | 
			
std::string::copy
		--- 通过给定 pos,可指定从pos开始拷贝进来 len个。
	
	size_t copy (char* s, size_t len, size_t pos = 0) const;
std::string::find
		--- 通过给定 pos,可指定从pos开始寻找。
	
	| string (1) | 
size_t find (const string& str, size_t pos = 0) const;  | 
			
|---|---|
| c-string (2) | 
size_t find (const char* s, size_t pos = 0) const;  | 
			
| buffer (3) | 
size_t find (const char* s, size_t pos, size_t n) const;  | 
			
| character (4) | 
size_t find (char c, size_t pos = 0) const;  | 
			
std::string::rfind
| string (1) | 
size_t rfind (const string& str, size_t pos = npos) const;  | 
			
|---|---|
| c-string (2) | 
size_t rfind (const char* s, size_t pos = npos) const;  | 
			
| buffer (3) | 
size_t rfind (const char* s, size_t pos, size_t n) const;  | 
			
| character (4) | 
size_t rfind (char c, size_t pos = npos) const;  | 
			
std::string::find_first_of
从开头寻找,匹配到 “aeiou”任意一个元素即可。---- 通过给定 pos,可指定从pos开始往后寻找。| string (1) | 
size_t find_first_of (const string& str, size_t pos = 0) const noexcept;  | 
			
|---|---|
| c-string (2) | 
size_t find_first_of (const char* s, size_t pos = 0) const;  | 
			
| buffer (3) | 
size_t find_first_of (const char* s, size_t pos, size_t n) const;  | 
			
| character (4) | 
size_t find_first_of (char c, size_t pos = 0) const noexcept;  | 
			
std::string::find_last_not_of
	--- 通过给定 pos,可指定从pos开始往前寻找。
		function
	
	
		<string>
	
	std::getline (string)
从输入流 is 中提取字符并将它们存储到 str 中,直到找到分隔字符delim (或换行符 '\n' )
	如果在 is 中到达文件末尾,或者在输入操作期间发生其他错误,则提取也会停止。
	如果找到分隔符,则会提取并丢弃它(即不存储它,换行符也是这样被对待。下一个输入操作将在它之后开始)。
	请注意,调用前 str 的任何内容都将替换为新提取的序列。
| (1) | 
istream& getline (istream& is, string& str, char delim); istream& getline (istream&& is, string& str, char delim);  | 
				
|---|---|
| (2) | 
istream& getline (istream& is, string& str); istream& getline (istream&& is, string& str);  | 
				
	我们可以使用getline()函数根据字符分割句子
	换行符 已经可以 把输入流的各行 分隔开了, 这个 delim 还能让输入流 分的更加碎。

京公网安备 11010502036488号