Skip to content

Commit 550c038

Browse files
committed
[Doc] Added examples to str.istitle()
1 parent 5f91d5d commit 550c038

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Doc/library/stdtypes.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,12 +2151,27 @@ expression support in the :mod:`re` module).
21512151
``B``, or ``S``.
21522152

21532153

2154+
.. _meth-str-istitle:
2155+
21542156
.. method:: str.istitle()
21552157

21562158
Return ``True`` if the string is a titlecased string and there is at least one
21572159
character, for example uppercase characters may only follow uncased characters
21582160
and lowercase characters only cased ones. Return ``False`` otherwise.
21592161

2162+
For example:
2163+
2164+
.. doctest::
2165+
2166+
>>> 'Spam, Spam, Spam'.istitle()
2167+
True
2168+
>>> 'spam, spam, spam'.istitle()
2169+
False
2170+
>>> 'SPAM, SPAM, SPAM'.istitle()
2171+
False
2172+
2173+
See also :meth:`title`.
2174+
21602175

21612176
.. method:: str.isupper()
21622177

@@ -2534,6 +2549,7 @@ expression support in the :mod:`re` module).
25342549
>>> titlecase("they're bill's friends.")
25352550
"They're Bill's Friends."
25362551

2552+
See also :meth:`istitle`.
25372553

25382554
.. method:: str.translate(table, /)
25392555

0 commit comments

Comments
 (0)