Commit 331ea92a authored by Victor Stinner's avatar Victor Stinner

Issue #9425: create Py_UNICODE_strrchr() function

parent e1dd1747
......@@ -1622,6 +1622,10 @@ PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strchr(
const Py_UNICODE *s, Py_UNICODE c
);
PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strrchr(
const Py_UNICODE *s, Py_UNICODE c
);
#ifdef __cplusplus
}
#endif
......
......@@ -9965,6 +9965,19 @@ Py_UNICODE_strchr(const Py_UNICODE *s, Py_UNICODE c)
return NULL;
}
Py_UNICODE*
Py_UNICODE_strrchr(const Py_UNICODE *s, Py_UNICODE c)
{
const Py_UNICODE *p;
p = s + Py_UNICODE_strlen(s);
while (p != s) {
p--;
if (*p == c)
return (Py_UNICODE*)p;
}
return NULL;
}
#ifdef __cplusplus
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment