<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # C `strcspn()`函數 > 原文: [https://beginnersbook.com/2017/11/c-strcspn-function/](https://beginnersbook.com/2017/11/c-strcspn-function/) **`strcspn()`函數**在主字符串中掃描給定字符串,并返回主字符串中從開頭到第一個匹配字符的字符數。 ## C `strcspn()`聲明 ```c size_t strcspn(const char *str1, const char *str2) ``` `str1` - 要搜索的主字符串 `str2` - 在主字符串中搜索此字符串的字符,直到找到第一個匹配的字符 ## 函數`strcspn()`的返回值 此函數返回在找到第一個匹配字符之前,找到的主字符串中的字符數。 ## C 中的函數`strcspn()`例子 ```c #include <stdio.h> #include <string.h> int main () { const char str[20] = "aabbccddeeff"; const char searchString[10] = "dxz"; int loc; /* This function returns the number of characters present in the main string * from beginning till the first matched character is found */ loc = strcspn(str, searchString); printf("The first matched char in string str1 is at: %d", (loc+1)); return 0; } ``` 輸出: ```c The first matched char in string str1 is at: 7 ``` 我們在主字符串`str`中搜索的字符是`'d'`,`'x'`和`'z'`,第一個匹配的字符位于主字符串中的第 7 位。 #### 相關文章: 1. [C - `strcat()`函數](https://beginnersbook.com/2017/11/c-strcat-function-with-example/) 2. [C - `strchr()`函數](https://beginnersbook.com/2017/11/c-strchr-function/) 3. [C - `strcmp()`函數](https://beginnersbook.com/2017/11/c-strcmp-function/) 4. [C - `strcpy()`函數](https://beginnersbook.com/2017/11/c-strcpy-function/)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看