Skip to content

Commit f10ce96

Browse files
Petr's review
Co-authored-by: Petr Viktorin <encukou@gmail.com>
1 parent 01fbfa1 commit f10ce96

File tree

1 file changed

+18
-29
lines changed

1 file changed

+18
-29
lines changed

Doc/c-api/conversion.rst

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -162,44 +162,33 @@ The following functions provide locale-independent string to number conversions.
162162
.. versionadded:: 3.1
163163
164164
165-
.. c:function:: int PyOS_stricmp(const char *s1, const char *s2)
166-
167-
Case insensitive comparison of strings. The function works almost
168-
identically to :c:func:`!strcmp` except that it ignores the case and locale.
169-
170-
This is an alias of :c:func:`PyOS_mystricmp` on all platforms except Windows,
171-
where it is an alias of :c:func:`!strcmp`.
172-
173-
174-
.. c:function:: int PyOS_strnicmp(const char *s1, const char *s2, Py_ssize_t size)
175-
176-
Case insensitive comparison of strings. The function works almost
177-
identically to :c:func:`!strncmp` except that it ignores the case and locale.
178-
179-
This is an alias of :c:func:`PyOS_mystricmp` on all platforms except Windows,
180-
where it is an alias of :c:func:`!strncmp`.
181-
182-
183165
.. c:function:: int PyOS_mystricmp(const char *str1, const char *str2)
166+
int PyOS_mystrnicmp(const char *str1, const char *str2, Py_ssize_t size)
167+
168+
Case insensitive comparison of strings. These functions work almost
169+
identically to :c:func:`!strcmp` and :c:func:`!strncmp` (respectively),
170+
except that they ignore the case of ASCII characters.
184171
185-
Case insensitive comparison of strings. The function works almost
186-
identically to :c:func:`!strcmp` except that it ignores the case and locale.
172+
Return ``0`` if the strings are equal, a negative value if *str1* sorts
173+
lexicographically before *str2*, or a positive value if it sorts after.
187174
188-
Return ``0`` if the strings are equal, a negative value if *str1* is less
189-
than *str2*, or a positive value if *str1* is greater than *str2*.
175+
In the *str1* or *str2* arguments, a NUL byte marks the end of the string.
176+
For :c:func:`!PyOS_mystrnicmp`, the *size* argument gives the maximum size
177+
of the string, as if NUL was present at the index given by *size*.
190178
191-
This function cannot fail.
179+
These functions do not use the locale.
192180
193181
194-
.. c:function:: int PyOS_mystrnicmp(const char *str1, const char *str2, Py_ssize_t size)
182+
.. c:function:: int PyOS_stricmp(const char *str1, const char *str2)
183+
int PyOS_strnicmp(const char *str1, const char *str2, Py_ssize_t size)
195184
196-
Case insensitive comparison of strings. The function works almost
197-
identically to :c:func:`!strncmp` except that it ignores the case and locale.
185+
Case insensitive comparison of strings.
198186
199-
Return ``0`` if the strings are equal, a negative value if *str1* is less
200-
than *str2*, or a positive value if *str1* is greater than *str2*.
187+
On Windows, these are aliases of :c:func:`!stricmp` and :c:func:`!strnicmp`,
188+
respectively.
201189
202-
This function cannot fail.
190+
On other platforms, they are aliases of :c:func:`PyOS_mystricmp` and
191+
:c:func:`PyOS_mystrnicmp`, respectively.
203192
204193
205194
Character classification and conversion

0 commit comments

Comments
 (0)