From 9a6f228e35431ae6b375320c0c6e81d3f1bd92c9 Mon Sep 17 00:00:00 2001 From: Adorilson Bezerra Date: Tue, 14 Oct 2025 11:19:27 -0300 Subject: [PATCH] gh-106318: Add examples for str.istitle() (GH-140046) (cherry picked from commit 07e617ecc274f21607320e68a7e8b09ee91f968b) Co-authored-by: Adorilson Bezerra --- Doc/library/stdtypes.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 45cec1027c104e..35791ffd8b08aa 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2021,6 +2021,19 @@ expression support in the :mod:`re` module). character, for example uppercase characters may only follow uncased characters and lowercase characters only cased ones. Return ``False`` otherwise. + For example: + + .. doctest:: + + >>> 'Spam, Spam, Spam'.istitle() + True + >>> 'spam, spam, spam'.istitle() + False + >>> 'SPAM, SPAM, SPAM'.istitle() + False + + See also :meth:`title`. + .. method:: str.isupper() @@ -2398,6 +2411,8 @@ expression support in the :mod:`re` module). >>> titlecase("they're bill's friends.") "They're Bill's Friends." + See also :meth:`istitle`. + .. method:: str.translate(table, /)