[ Web Proxy ]
URL:
Viewing: https://ru.cppreference.com/cpp/string/wide/wcspbrk [Back]  [Original]

std::wcspbrk cppreference.com
cppreference.com

std::wcspbrk

cppreference.com
<tbody> </tbody>
const wchar_t* wcspbrk( const wchar_t* dest, const wchar_t* src );
  wchar_t* wcspbrk( wchar_t* dest, const wchar_t* src );

, dest, , src.

dest ,
src ,

dest, src, , .

"wide character string pointer break - ", - ("").

#include <cwchar>
#include <iomanip>
#include <iostream>
 
int main()
{
    const wchar_t* str = L" ,  !";
    const wchar_t* sep = L" ,!";
 
    std::wcout.imbue(std::locale("en_US.utf8"));
    unsigned int cnt = 0;
    do
    {
        str = std::wcspbrk(str, sep); //  
        std::wcout << std::quoted(str) << L'\n';
        if (str)
            str += std::wcsspn(str, sep); //  
        ++cnt; //   
    } while (str && *str);
 
    std::wcout << L" " << cnt << L" \n";
}

:

" world, friend of mine!"
", friend of mine!"
" of mine!"
" mine!"
"!"
There are 5 words

,

() []

() []

() []
C wcspbrk

Web Proxy Viewer  |  New URL  |  Original Page