programming - C - function strpbrkWhat links here?
Defined in '''string.h'''.

Scan string for specified characters.

Scans string1 character by character, returning a pointer to the first character that matches with any of the characters in string2. The search does not includes the terminating null-characters.

Syntax



Parameters



Return Value

A pointer to the first appearance in string1 of a character specified in string2.

If none of the characters specified in string2 exists in string1, a NULL pointer is returned.

Portability.

Defined in ANSI-C.

ANSI-C++ standard specifies two different declarations for this function instead of the one included in ANSI-C:

const char* strpbrk(const char* string1, const char* string2);
char* strpbrk(char* string1, const char* string2);


Both have the same behavior as the original declaration.

Example

/* strpbrk example */
  1. include
  2. include


int main () { char str[] = "This is a sample string"; char key[] = "aeiou"; char * pch; printf ("Vowels in '%s': ",str); pch = strpbrk (str, key); while (pch != NULL) { printf ("%c " , *pch); pch = strpbrk (pch+1,key); } printf ("\n"); return 0; }

Output: Vowels in 'This is a sample string': i i a a e i


See also

[strcspn], programming c:function strchr, programming c:function strrchr, [strstr]
programming - C - function strpbrk
microprocessors - microchip 16F84A - status register
Topical Bible - God Almighty
Topical Bible - New Testament giving
embedded systems - bacnet - message formats - bacnet-ip
Topical Bible - Judge not...
programming - HTML - checkbox
Topical Bible - Original sin
file formats - PDF - trailer
file formats - PDF - resource dictionaries
programming - C - function ferror
Topical Bible - Pharisees
MC6802 - instruction set - Load stack pointer
Topical Bible - Jesus the visible revelation of the invisible God
programming - C - function strpos
programming - HTML - radio button
embedded systems - bacnet - specific messages
MC6802 - instruction set - No Operation
filename:programming - C - function strpbrk
filename:programming%20%2D%20C%20%2D%20function%20strpbrk
last edit:April 05 2009 22:11:02 (5521 days ago)
ct = 1716059054.000000 = May 18 2024 15:04:14
ft = 1238983862.000000 = April 05 2009 22:11:02
dt = 477075192.000000