diff options
Diffstat (limited to 'devdocs/c/string%2Fbyte%2Fstrspn.html')
| -rw-r--r-- | devdocs/c/string%2Fbyte%2Fstrspn.html | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/devdocs/c/string%2Fbyte%2Fstrspn.html b/devdocs/c/string%2Fbyte%2Fstrspn.html new file mode 100644 index 00000000..1d11b48e --- /dev/null +++ b/devdocs/c/string%2Fbyte%2Fstrspn.html @@ -0,0 +1,38 @@ + <h1 id="firstHeading" class="firstHeading">strspn</h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code><string.h></code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl"> <td class="t-dcl-nopad"> <pre data-language="c">size_t strspn( const char *dest, const char *src );</pre> +</td> <td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> </table> <p>Returns the length of the maximum initial segment (span) of the null-terminated byte string pointed to by <code>dest</code>, that consists of only the characters found in the null-terminated byte string pointed to by <code>src</code>.</p> +<p>The behavior is undefined if either <code>dest</code> or <code>src</code> is not a pointer to a null-terminated byte string.</p> +<h3 id="Parameters"> Parameters</h3> <table class="t-par-begin"> <tr class="t-par"> <td> dest </td> <td> - </td> <td> pointer to the null-terminated byte string to be analyzed </td> +</tr> <tr class="t-par"> <td> src </td> <td> - </td> <td> pointer to the null-terminated byte string that contains the characters to search for </td> +</tr> +</table> <h3 id="Return_value"> Return value</h3> <p>The length of the maximum initial segment that contains only characters from the null-terminated byte string pointed to by <code>src</code></p> +<h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include <string.h> +#include <stdio.h> + +int main(void) +{ + const char *string = "abcde312$#@"; + const char *low_alpha = "qwertyuiopasdfghjklzxcvbnm"; + + size_t spnsz = strspn(string, low_alpha); + printf("After skipping initial lowercase letters from '%s'\n" + "The remainder is '%s'\n", string, string+spnsz); +}</pre></div> <p>Output:</p> +<div class="text source-text"><pre data-language="c">After skipping initial lowercase letters from 'abcde312$#@' +The remainder is '312$#@'</pre></div> </div> <h3 id="References"> References</h3> <ul> +<li> C11 standard (ISO/IEC 9899:2011): </li> +<ul><li> 7.24.5.6 The strspn function (p: 369) </li></ul> +<li> C99 standard (ISO/IEC 9899:1999): </li> +<ul><li> 7.21.5.6 The strspn function (p: 332) </li></ul> +<li> C89/C90 standard (ISO/IEC 9899:1990): </li> +<ul><li> 4.11.5.6 The strspn function </li></ul> +</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="strcspn" title="c/string/byte/strcspn"> <span class="t-lines"><span>strcspn</span></span></a></div> </td> <td> returns the length of the maximum initial segment that consists <br> of only the characters not found in another byte string <br> <span class="t-mark">(function)</span> </td> +</tr> <tr class="t-dsc"> <td> <div><a href="../wide/wcsspn" title="c/string/wide/wcsspn"> <span class="t-lines"><span>wcsspn</span></span></a></div> +<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span></span></div> </td> <td> returns the length of the maximum initial segment that consists <br> of only the wide characters found in another wide string <br> <span class="t-mark">(function)</span> </td> +</tr> <tr class="t-dsc"> <td> <div><a href="strpbrk" title="c/string/byte/strpbrk"> <span class="t-lines"><span>strpbrk</span></span></a></div> </td> <td> finds the first location of any character in one string, in another string <br> <span class="t-mark">(function)</span> </td> +</tr> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/string/byte/strspn" title="cpp/string/byte/strspn">C++ documentation</a></span> for <code>strspn</code> </td> +</tr> </table> <div class="_attribution"> + <p class="_attribution-p"> + © cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br> + <a href="https://en.cppreference.com/w/c/string/byte/strspn" class="_attribution-link">https://en.cppreference.com/w/c/string/byte/strspn</a> + </p> +</div> |
