summaryrefslogtreecommitdiffstats
path: root/Include/unicodeobject.h
diff options
context:
space:
mode:
authorHye-Shik Chang <hyeshik@gmail.com>2003-12-15 18:49:53 (GMT)
committerHye-Shik Chang <hyeshik@gmail.com>2003-12-15 18:49:53 (GMT)
commit3ae811b57d227a220f207869487fd9251e278608 (patch)
treeccbc4b81578fa69e6bc65df8da4994bf9a4b6e49 /Include/unicodeobject.h
parentdce391cb398f4ce266d98130d10810a6a36617b3 (diff)
downloadcpython-3ae811b57d227a220f207869487fd9251e278608.zip
cpython-3ae811b57d227a220f207869487fd9251e278608.tar.gz
cpython-3ae811b57d227a220f207869487fd9251e278608.tar.bz2
Add rsplit method for str and unicode builtin types.
SF feature request #801847. Original patch is written by Sean Reifschneider.
Diffstat (limited to 'Include/unicodeobject.h')
-rw-r--r--Include/unicodeobject.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index 24e59de..1690f8a 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -185,6 +185,7 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
# define PyUnicode_Resize PyUnicodeUCS2_Resize
# define PyUnicode_SetDefaultEncoding PyUnicodeUCS2_SetDefaultEncoding
# define PyUnicode_Split PyUnicodeUCS2_Split
+# define PyUnicode_RSplit PyUnicodeUCS2_RSplit
# define PyUnicode_Splitlines PyUnicodeUCS2_Splitlines
# define PyUnicode_Tailmatch PyUnicodeUCS2_Tailmatch
# define PyUnicode_Translate PyUnicodeUCS2_Translate
@@ -959,6 +960,25 @@ PyAPI_FUNC(PyObject*) PyUnicode_Splitlines(
int keepends /* If true, line end markers are included */
);
+/* Split a string giving a list of Unicode strings.
+
+ If sep is NULL, splitting will be done at all whitespace
+ substrings. Otherwise, splits occur at the given separator.
+
+ At most maxsplit splits will be done. But unlike PyUnicode_Split
+ PyUnicode_RSplit splits from the end of the string. If negative,
+ no limit is set.
+
+ Separators are not included in the resulting list.
+
+*/
+
+PyAPI_FUNC(PyObject*) PyUnicode_RSplit(
+ PyObject *s, /* String to split */
+ PyObject *sep, /* String separator */
+ int maxsplit /* Maxsplit count */
+ );
+
/* Translate a string by applying a character mapping table to it and
return the resulting Unicode object.