Copyright (C) 2000-2012 |
GNU Info (python2.1-api.info)Methods and Slot FunctionsMethods and Slot Functions .......................... 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. `PyObject* PyUnicode_Concat(PyObject *left, PyObject *right)' Concat two strings giving a new Unicode string. `PyObject* PyUnicode_Split(PyObject *s, PyObject *sep, int maxsplit)' 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. If negative, no limit is set. Separators are not included in the resulting list. `PyObject* PyUnicode_Splitlines(PyObject *s, int maxsplit)' 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. `PyObject* PyUnicode_Translate(PyObject *str, PyObject *table, const char *errors)' 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. `PyObject* PyUnicode_Join(PyObject *separator, PyObject *seq)' 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 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 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)' Count the number of occurrences of SUBSTR in STR[START:END] `PyObject* PyUnicode_Replace(PyObject *str, PyObject *substr, PyObject *replstr, int maxcount)' Replace at most MAXCOUNT occurrences of SUBSTR in STR with REPLSTR and return the resulting Unicode object. MAXCOUNT == -1 means: replace all occurrences. `int PyUnicode_Compare(PyObject *left, PyObject *right)' Compare two strings and return -1, 0, 1 for less than, equal, greater than resp. `PyObject* PyUnicode_Format(PyObject *format, PyObject *args)' Returns a new string object from FORMAT and ARGS; this is analogous to `FORMAT % ARGS'. The ARGS argument must be a tuple. `int PyUnicode_Contains(PyObject *container, PyObject *element)' Checks whether ELEMENT is contained in CONTAINER and returns true or false accordingly. ELEMENT has to coerce to a one element Unicode string. `-1' is returned in case of an error. automatically generated by info2www version 1.2.2.9 |