标签:style http color strong for io
char *strpbrk( const char *string, const char *strCharSet ); wchar_t *wcspbrk( const wchar_t *string, const wchar_t *strCharSet );
char * strpbrk(const char * cs,const char * ct)
{
const char *sc1,*sc2;
for( sc1 = cs; *sc1 != '\0'; ++sc1) {
for( sc2 = ct; *sc2 != '\0'; ++sc2) {
if (*sc1 == *sc2)
return (char *) sc1;
}
}
return NULL;
}
/* STRPBRK.C */
#include <string.h>
#include <stdio.h>
void main( void )
{
char string[100] = "The 3 men and 2 boys ate 5 pigs\n";
char *result;
/* Return pointer to first 'a' or 'b' in "string" */
printf( "1: %s\n", string );
result = strpbrk( string, "0123456789" );
printf( "2: %s\n", result++ );
result = strpbrk( result, "0123456789" );
printf( "3: %s\n", result++ );
result = strpbrk( result, "0123456789" );
printf( "4: %s\n", result );
}
标签:style http color strong for io
原文地址:http://blog.csdn.net/u010236550/article/details/37810371