diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-08-10 16:37:20 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-08-10 16:37:20 (GMT) |
commit | 331ea92ade37e5dcf14c44df59e5eda2136b1a8f (patch) | |
tree | 530dad9524b4b4f2dfd795a0ab25ee35d4e82291 /Objects/unicodeobject.c | |
parent | e1dd1747e8750ed8a7641d59899e3cb8db5ddca9 (diff) | |
download | cpython-331ea92ade37e5dcf14c44df59e5eda2136b1a8f.zip cpython-331ea92ade37e5dcf14c44df59e5eda2136b1a8f.tar.gz cpython-331ea92ade37e5dcf14c44df59e5eda2136b1a8f.tar.bz2 |
Issue #9425: create Py_UNICODE_strrchr() function
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index f2d666d..478f9a9 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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 } |