libc: core: implement strrchr

This commit is contained in:
2026-07-19 13:29:14 +01:00
parent 67b460e4e1
commit 8aa76b5b7f
2 changed files with 15 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
#include <string.h>
char *strrchr(const char *str, int c)
{
size_t len = strlen(str);
for (int i = len - 1; i > 0; i--) {
if (str[i] == c) {
return (char *)&str[i];
}
}
return NULL;
}