diff options
Diffstat (limited to 'devdocs/c/string%2Fwide%2Fwcspbrk.html')
| -rw-r--r-- | devdocs/c/string%2Fwide%2Fwcspbrk.html | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/devdocs/c/string%2Fwide%2Fwcspbrk.html b/devdocs/c/string%2Fwide%2Fwcspbrk.html new file mode 100644 index 00000000..f6d7a55a --- /dev/null +++ b/devdocs/c/string%2Fwide%2Fwcspbrk.html @@ -0,0 +1,47 @@ + <h1 id="firstHeading" class="firstHeading">wcspbrk</h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code><wchar.h></code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl t-since-c95"> <td> <pre data-language="c">wchar_t *wcspbrk( const wchar_t *dest, const wchar_t *str );</pre> +</td> <td> (1) </td> <td> <span class="t-mark-rev t-since-c95">(since C95)</span> </td> </tr> <tr class="t-dcl t-since-c23"> <td> <pre data-language="c">/*QWchar_t*/ *wcspbrk( /*QWchar_t*/ *dest, const wchar_t *str );</pre> +</td> <td> (2) </td> <td> <span class="t-mark-rev t-since-c23">(since C23)</span> </td> </tr> </table> <div class="t-li1"> +<span class="t-li">1)</span> Finds the first character in wide string pointed to by <code>dest</code>, that is also in wide string pointed to by <code>str</code>.</div> <div class="t-li1"> +<span class="t-li">2)</span> Type-generic function equivalent to <span class="t-v">(1)</span>. Let <code>T</code> be an unqualified wide character object type. <ul> +<li> If <code>dest</code> is of type <code>const T*</code>, the return type is <code>const wchar_t*</code>. </li> +<li> Otherwise, if <code>dest</code> is of type <code>T*</code>, the return type is <code>wchar_t*</code>. </li> +<li> Otherwise, the behavior is undefined. </li> +</ul> If a macro definition of each of these generic functions is suppressed to access an actual function (e.g. if <code>(wcspbrk)</code> or a function pointer is used), the actual function declaration <span class="t-v">(1)</span> becomes visible.</div> <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 wide string to be analyzed </td> +</tr> <tr class="t-par"> <td> src </td> <td> - </td> <td> pointer to the null-terminated wide string that contains the characters to search for </td> +</tr> +</table> <h3 id="Return_value"> Return value</h3> <p>Pointer to the first character in <code>dest</code>, that is also in <code>str</code>, or a null pointer if no such character exists.</p> +<h3 id="Notes"> Notes</h3> <p>The name stands for "wide character string pointer break", because it returns a pointer to the first of the separator ("break") characters.</p> +<h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include <stdio.h> +#include <wchar.h> + +int main(void) +{ + const wchar_t* str = L"Hello world, friend of mine!"; + const wchar_t* sep = L" ,!"; + + unsigned int cnt = 0; + do { + str = wcspbrk(str, sep); // find separator + if (str) str += wcsspn(str, sep); // skip separator + ++cnt; // increment word count + } while (str && *str); + + wprintf(L"There are %u words.\n", cnt); +}</pre></div> <p>Output:</p> +<div class="text source-text"><pre data-language="c">There are 5 words.</pre></div> </div> <h3 id="References"> References</h3> <ul> +<li> C11 standard (ISO/IEC 9899:2011): </li> +<ul><li> 7.29.4.5.3 The wcspbrk function (p: 436) </li></ul> +<li> C99 standard (ISO/IEC 9899:1999): </li> +<ul><li> 7.24.4.5.3 The wcspbrk function (p: 382) </li></ul> +</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="wcscspn" title="c/string/wide/wcscspn"> <span class="t-lines"><span>wcscspn</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 chars <i>not</i> found in another wide string <br> <span class="t-mark">(function)</span> </td> +</tr> <tr class="t-dsc"> <td> <div><a href="wcschr" title="c/string/wide/wcschr"> <span class="t-lines"><span>wcschr</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> finds the first occurrence of a wide character in a wide string <br> <span class="t-mark">(function)</span> </td> +</tr> <tr class="t-dsc"> <td> <div><a href="../byte/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/wide/wcspbrk" title="cpp/string/wide/wcspbrk">C++ documentation</a></span> for <code>wcspbrk</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/wide/wcspbrk" class="_attribution-link">https://en.cppreference.com/w/c/string/wide/wcspbrk</a> + </p> +</div> |
