⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 find_first_not_of.html

📁 从www.CppReference.com打包的C++参考手册
💻 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>find_first_not_of</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> &gt; <a href=    "index.html">C++ Strings</a> &gt; <a href=    "find_first_not_of.html">find_first_not_of</a>  </div>  <div class="name-format">    find_first_not_of  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;string&gt;  <strong>size_type</strong> find_first_not_of( const string&amp; str, <strong>size_type</strong> index = 0 );  <strong>size_type</strong> find_first_not_of( const char* str, <strong>size_type</strong> index = 0 );  <strong>size_type</strong> find_first_not_of( const char* str, <strong>size_type</strong> index, <strong>size_type</strong> num );  <strong>size_type</strong> find_first_not_of( char ch, <strong>size_type</strong> index = 0 );</pre>  <p>The find_first_not_of() function either:</p>  <ul>    <li>returns the index of the first character within the current    string that does not match any character in <em>str</em>, beginning    the search at <em>index</em>, string::npos if nothing is    found,</li>    <li>searches the current string, beginning at <em>index</em>, for    any character that does not match the first <em>num</em>    characters in <em>str</em>, returning the index in the current    string of the first character found that meets this criteria,    otherwise returning string::npos,</li>    <li>or returns the index of the first occurrence of a character    that does not match <em>ch</em> in the current string, starting the    search at <em>index</em>, string::npos if nothing is found.</li>  </ul>  <p>For example, the following code searches a string of text for the  first character that is not a lower-case character, space, comma, or  hypen:</p>  <pre class="example-code">  string lower_case = &quot;abcdefghijklmnopqrstuvwxyz ,-&quot;;  string str = &quot;this is the lower-case part, AND THIS IS THE UPPER-CASE PART&quot;;  cout &lt;&lt; &quot;first non-lower-case letter in str at: &quot; &lt;&lt; str.find_first_not_of(lower_case) &lt;&lt; endl;            </pre>  <p>When run, find_first_not_of() finds the first upper-case letter in  <em>str</em> at index 29 and displays this output:</p>  <pre class="example-code">  first non-lower-case letter in str at: 29              </pre>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="find.html">find</a><br>    <a href="find_first_not_of.html">find_first_not_of</a><br>    <a href="find_first_of.html">find_first_of</a><br>    <a href="find_last_not_of.html">find_last_not_of</a><br>    <a href="find_last_of.html">find_last_of</a><br>    <a href="rfind.html">rfind</a>  </div>  </div>  </td>    </tr>  </table></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -