libluna+libc: Add strpbrk()
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3618a41bcd
commit
193d63c81b
@ -65,6 +65,9 @@ extern "C"
|
||||
/* Return the length of the initial segment of str which consists only of bytes not in reject. */
|
||||
size_t strcspn(const char* str, const char* reject);
|
||||
|
||||
/* Return a pointer to the first occurrence of any of the characters in accept in s. */
|
||||
char* strpbrk(const char* s, const char* delim);
|
||||
|
||||
/* Separate a string into several tokens. */
|
||||
char* strtok(char* str, const char* delim);
|
||||
|
||||
|
@ -34,4 +34,6 @@ extern "C"
|
||||
|
||||
char* strchr(const char* str, int c);
|
||||
char* strrchr(const char* str, int c);
|
||||
|
||||
char* strpbrk(const char* s, const char* accept);
|
||||
}
|
||||
|
@ -237,4 +237,15 @@ extern "C"
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
char* strpbrk(const char* s, const char* accept)
|
||||
{
|
||||
usize index = strcspn(s, accept);
|
||||
|
||||
const char* ptr = s + index;
|
||||
|
||||
if (*ptr) return const_cast<char*>(ptr);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user