Skip to content

Commit 51a56a3

Browse files
adorilsonvstinnerStanFromIreland
authored
gh-106318: Add examples for str.casefold() and str.lower() methods (#142154)
Co-authored-by: Victor Stinner <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]>
1 parent b2827de commit 51a56a3

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Doc/library/stdtypes.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1844,6 +1844,14 @@ expression support in the :mod:`re` module).
18441844
lowercase letter ``'ß'`` is equivalent to ``"ss"``. Since it is already
18451845
lowercase, :meth:`lower` would do nothing to ``'ß'``; :meth:`casefold`
18461846
converts it to ``"ss"``.
1847+
For example:
1848+
1849+
.. doctest::
1850+
1851+
>>> 'straße'.lower()
1852+
'straße'
1853+
>>> 'straße'.casefold()
1854+
'strasse'
18471855

18481856
The casefolding algorithm is `described in section 3.13.3 'Default Case
18491857
Folding' of the Unicode Standard
@@ -2300,7 +2308,12 @@ expression support in the :mod:`re` module).
23002308
.. method:: str.lower()
23012309

23022310
Return a copy of the string with all the cased characters [4]_ converted to
2303-
lowercase.
2311+
lowercase. For example:
2312+
2313+
.. doctest::
2314+
2315+
>>> 'Lower Method Example'.lower()
2316+
'lower method example'
23042317

23052318
The lowercasing algorithm used is `described in section 3.13.2 'Default Case
23062319
Conversion' of the Unicode Standard

0 commit comments

Comments
 (0)