📄 insert.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head> <meta name="generator" content= "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org"> <title>insert</title> <link href="../cppreference.css" rel="stylesheet" type="text/css"></head><body><table> <tr> <td> <div class="body-content"> <div class="header-box"> <a href="../index.html">cppreference.com</a> > <a href= "index.html">C++ Strings</a> > <a href="insert.html">insert</a> </div> <div class="name-format"> insert </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <string> iterator insert( iterator i, const char& ch ); string& insert( <strong>size_type</strong> index, const string& str ); string& insert( <strong>size_type</strong> index, const char* str ); string& insert( <strong>size_type</strong> index1, const string& str, <strong>size_type</strong> index2, <strong>size_type</strong> num ); string& insert( <strong>size_type</strong> index, const char* str, <strong>size_type</strong> num ); string& insert( <strong>size_type</strong> index, <strong>size_type</strong> num, char ch ); void insert( iterator i, <strong>size_type</strong> num, const char& ch ); void insert( iterator i, iterator start, iterator end );</pre> <p>The very multi-purpose insert() function either:</p> <ul> <li>inserts <em>ch</em> before the character denoted by <em>i</em>,</li> <li>inserts <em>str</em> into the current string, at location <em>index</em>,</li> <li>inserts a substring of <em>str</em> (starting at <em>index2</em> and <em>num</em> characters long) into the current string, at location <em>index1</em>,</li> <li>inserts <em>num</em> characters of <em>str</em> into the current string, at location <em>index</em>,</li> <li>inserts <em>num</em> copies of <em>ch</em> into the current string, at location <em>index</em>,</li> <li>inserts <em>num</em> copies of <em>ch</em> into the current string, before the character denoted by <em>i</em>,</li> <li>or inserts the characters denoted by <em>start</em> and <em>end</em> into the current string, before the character specified by <em>i</em>.</li> </ul> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="erase.html">erase</a><br> <a href="replace.html">replace</a> </div> </div> </td> </tr> </table></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -