The following APIs are capable of handling Unicode objects and strings
on input (we refer to them as strings in the descriptions) and return
Unicode objects or integers as apporpriate.
They all return NULL or -1 in case an exception occurrs.
Split a Unicode string at line breaks, returning a list of Unicode
strings. CRLF is considered to be one line break. The Line break
characters are not included in the resulting strings.
Translate a string by applying a character mapping table to it and
return the resulting Unicode object.
The mapping table must map Unicode ordinal integers to Unicode ordinal
integers or None (causing deletion of the character).
Mapping tables must only provide the __getitem__ interface,
e.g. dictionaries or sequences. Unmapped character ordinals (ones
which cause a LookupError) are left untouched and are copied as-is.
errors has the usual meaning for codecs. It may be NULL
which indicates to use the default error handling.
Join a sequence of strings using the given separator and return
the resulting Unicode string.
PyObject* PyUnicode_Tailmatch(PyObject *str,
PyObject *substr,
int start,
int end,
int direction)
Return value:New reference.
Return 1 if substr matches str[start:end] at
the given tail end (direction == -1 means to do a prefix match,
direction == 1 a suffix match), 0 otherwise.
PyObject* PyUnicode_Find(PyObject *str,
PyObject *substr,
int start,
int end,
int direction)
Return value:New reference.
Return the first position of substr in
str[start:end] using the given direction
(direction == 1 means to do a forward search,
direction == -1 a backward search), 0 otherwise.
PyObject* PyUnicode_Count(PyObject *str,
PyObject *substr,
int start,
int end)
Return value:New reference.
Count the number of occurrences of substr in
str[start:end]
PyObject* PyUnicode_Replace(PyObject *str,
PyObject *substr,
PyObject *replstr,
int maxcount)
Return value:New reference.
Replace at most maxcount occurrences of substr in
str with replstr and return the resulting Unicode object.
maxcount == -1 means: replace all occurrences.