Table of Contents
The istitle() returns True if the string is a titlecased string. If not, it returns False.
The syntax of istitle()
method is:
string.istitle()
1. istitle() Parameters
The istitle()
method doesn’t take any parameters.
2. Return Value from istitle()
The istitle()
method returns:
True
if the string is a titlecased stringFalse
if the string is not a titlecased string or an empty string
3. Example 1: Working of istitle()
s = 'Python Is Good.' print(s.istitle()) s = 'Python is good' print(s.istitle()) s = 'This Is @ Symbol.' print(s.istitle()) s = '99 Is A Number' print(s.istitle()) s = 'PYTHON' print(s.istitle())
Output
True False True True False
4. Example 2: How to use istitle()?
s = 'I Love Python.' if s.istitle() == True: print('Titlecased String') else: print('Not a Titlecased String') s = 'PYthon' if s.istitle() == True: print('Titlecased String') else: print('Not a Titlecased String')
Output
Titlecased String Not a Titlecased String
Related posts:
Python Program to Find the Largest Among Three Numbers
Python Type Conversion and Type Casting
Encode a String to UTF-8 in Java
Convert String to int or Integer in Java
Python Program to Count the Number of Digits Present In a Number
Python del Statement
Python Operators
Python max()
Jackson – Marshall String to JsonNode
Python bytearray()
Check if a String is a Palindrome in Java
Python id()
Python RegEx
Python String isprintable()
Python String lower()
Python List reverse()
Python filter()
Python Function Arguments
Python input()
Java – Generate Random String
Python Set difference_update()
Python Dictionary fromkeys()
String Hashing
Python Program to Count the Number of Each Vowel
Python Set copy()
Check If a String Is Numeric in Java
Python String casefold()
Python Program to Iterate Through Two Lists in Parallel
Machine Learning with Python for everyone - Mark E.Fenner
Python Program to Convert Bytes to a String
Python Errors and Built-in Exceptions
Python Program to Convert Decimal to Binary Using Recursion