libc: Add strpbrk()
This commit is contained in:
parent
4d71c0ef04
commit
503a04f0e9
@ -58,6 +58,9 @@ extern "C"
|
||||
/* Returns the length of the initial segment of str which consists entirely of bytes in accept. */
|
||||
size_t strspn(const char* str, const char* accept);
|
||||
|
||||
/* Returns a pointer to the first occurrence of any character of b in a. */
|
||||
char* strpbrk(const char* a, const char* b);
|
||||
|
||||
/* Compares strings a and b. You might prefer to use the safer strncmp function. */
|
||||
int strcmp(const char* a, const char* b);
|
||||
|
||||
|
@ -167,6 +167,16 @@ extern "C"
|
||||
return s - str;
|
||||
}
|
||||
|
||||
char* strpbrk(const char* a, const char* b)
|
||||
{
|
||||
while (*a)
|
||||
{
|
||||
if (strchr(b, *a)) return const_cast<char*>(a);
|
||||
a++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char* strcat(char* dest, const char* src)
|
||||
{
|
||||
size_t dest_len = strlen(dest);
|
||||
|
Loading…
Reference in New Issue
Block a user