diff options
Diffstat (limited to 'devdocs/c/string%2Fwide%2Fwcsstr.html')
| -rw-r--r-- | devdocs/c/string%2Fwide%2Fwcsstr.html | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/devdocs/c/string%2Fwide%2Fwcsstr.html b/devdocs/c/string%2Fwide%2Fwcsstr.html new file mode 100644 index 00000000..d6afb5a4 --- /dev/null +++ b/devdocs/c/string%2Fwide%2Fwcsstr.html @@ -0,0 +1,50 @@ + <h1 id="firstHeading" class="firstHeading">wcsstr</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 *wcsstr( const wchar_t *dest, const wchar_t *src );</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*/ *wcsstr( /*QWchar_t*/ *dest, const wchar_t *src );</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 occurrence of the wide string <code>src</code> in the wide string pointed to by <code>dest</code>. The terminating null characters are not compared.</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>(wcsstr)</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 examine </td> +</tr> <tr class="t-par"> <td> src </td> <td> - </td> <td> pointer to the null-terminated wide string to search for </td> +</tr> +</table> <h3 id="Return_value"> Return value</h3> <p>Pointer to the first character of the found substring in <code>dest</code>, or a null pointer if no such substring is found. If <code>src</code> points to an empty string, <code>dest</code> is returned.</p> +<h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include <stdio.h> +#include <locale.h> +#include <wchar.h> + +int main(void) +{ + setlocale(LC_ALL, "ru_RU.UTF-8"); + + wchar_t str[5][64] = { + L"Строка, где есть подстрока 'но'.", + L"Строка, где такой подстроки нет.", + L"Он здесь.", + L"Здесь он.", + L"Его нет." + }; + + for (size_t i = 0; i < 5; ++i) { + if (wcsstr(str[i], L"но")) { + wprintf(L"%ls\n", str[i]); + } + } +}</pre></div> <p>Output:</p> +<div class="text source-text"><pre data-language="c">Строка, где есть подстрока 'но'.</pre></div> </div> <h3 id="References"> References</h3> <ul> +<li> C11 standard (ISO/IEC 9899:2011): </li> +<ul><li> 7.29.4.5.6 The wcsstr function (p: 437) </li></ul> +<li> C99 standard (ISO/IEC 9899:1999): </li> +<ul><li> 7.24.4.5.6 The wcsstr function (p: 383) </li></ul> +</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <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="wcsrchr" title="c/string/wide/wcsrchr"> <span class="t-lines"><span>wcsrchr</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 last occurrence of a wide character in a wide 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/wcsstr" title="cpp/string/wide/wcsstr">C++ documentation</a></span> for <code>wcsstr</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/wcsstr" class="_attribution-link">https://en.cppreference.com/w/c/string/wide/wcsstr</a> + </p> +</div> |
