Determines whether the string is a titlecased string
Usage
The istitle()
method returns TRUE if the string is nonempty and a titlecased string. Otherwise, it returns FALSE.
Numbers and special characters are ignored.
In titlecased string each word starts with an uppercase character and the remaining characters are lowercase.
Syntax
string.istitle()
Examples
# Check if the string is a titlecased string
# titlecase
S = 'Hello World'
print(S.istitle())
# Prints True
# numbers and characters are ignored
S = '*** Hello, World! 123'
print(S.istitle())
# Prints True
Below are a few examples where istitle()
method returns false.
# uppercase
S = 'HELLO, WORLD!'
print(S.istitle())
# Prints False
# lowercase
S = 'hello, world!'
print(S.istitle())
# Prints False