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

std::strpbrk cppreference.com
cppreference.com

std::strpbrk

cppreference.com
<tbody> </tbody>
const char* strpbrk( const char* dest, const char* breakset );
  char* strpbrk( char* dest, const char* breakset );

, dest, , breakset, .

dest ,
breakset ,

dest, breakset, , .

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

#include <cstring>
#include <iomanip>
#include <iostream>

int main()
{
    const char* str = "hello world, friend of mine!";
    const char* sep = " ,!";

    unsigned int cnt = 0;
    do
    {
        str = std::strpbrk(str, sep); //  
        std::cout << std::quoted(str) << '\n';
        if (str)
            str += std::strspn(str, sep); //  
        ++cnt; //   
    } while (str && *str);

    std::cout << " " << cnt << " \n";
}

:

" world, friend of mine!"
", friend of mine!"
" of mine!"
" mine!"
"!"
 5 

,
,
() []

() []

() []
,
() []
C strpbrk

Web Proxy Viewer  |  New URL  |  Original Page