diff --git a/libs/libc/include/string.h b/libs/libc/include/string.h index 5e495514..2d79f1a2 100644 --- a/libs/libc/include/string.h +++ b/libs/libc/include/string.h @@ -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); diff --git a/libs/libc/src/string.cpp b/libs/libc/src/string.cpp index 85e0e8b3..e4e1d235 100644 --- a/libs/libc/src/string.cpp +++ b/libs/libc/src/string.cpp @@ -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(a); + a++; + } + return NULL; + } + char* strcat(char* dest, const char* src) { size_t dest_len = strlen(dest);