Table of Contents
The string isupper() method returns whether or not all characters in a string are uppercased or not.
The syntax of isupper()
method is:
1 | string.isupper() |
1. String isupper() Parameters
The isupper()
method doesn’t take any parameters.
2. Return value from String isupper()
The isupper()
method returns:
- True if all characters in a string are uppercase characters
- False if any characters in a string are lowercase characters
3. Example 1: Return value of isupper()
1 2 3 4 5 6 7 8 9 10 11 | # example string string = "THIS IS GOOD!" print (string.isupper()); # numbers in place of alphabets string = "THIS IS ALSO G00D!" print (string.isupper()); # lowercase string string = "THIS IS not GOOD!" print (string.isupper()); |
Output
1 2 3 | True True False |
4. Example 2: How to use isupper() in a program?
1 2 3 4 5 6 7 8 9 10 11 | string = 'THIS IS GOOD' if string.isupper() = = True : print ( 'Does not contain lowercase letter.' ) else : print ( 'Contains lowercase letter.' ) string = 'THIS IS gOOD' if string.isupper() = = True : print ( 'Does not contain lowercase letter.' ) else : print ( 'Contains lowercase letter.' ) |
Output
1 2 | Does not contain lowercase letter. Contains lowercase letter. |
Related posts:
Converting a Stack Trace to a String in Java
Natural Language Processing with Python - Steven Bird & Ewan Klein & Edward Loper
Python List remove()
Python String isnumeric()
Python Directory and Files Management
Python pow()
Python String islower()
Count Occurrences of a Char in a String
Python Program to Convert Bytes to a String
Python String isalnum()
Python Shallow Copy and Deep Copy
Python Type Conversion and Type Casting
Array to String Conversions
Converting String to Stream of chars
Python Program to Print Colored Text to the Terminal
Python String count()
Python List sort()
Python Program to Catch Multiple Exceptions in One Line
Python String center()
Python Program to Find the Largest Among Three Numbers
Python Program to Get the File Name From the File Path
Python Global Keyword
Convert String to int or Integer in Java
Python format()
Python Program to Iterate Through Two Lists in Parallel
Python Set issuperset()
Python @property decorator
Python Set intersection_update()
Python Deep Learning - Valentino Zocca & Gianmario Spacagna & Daniel Slater & Peter Roelants
Python max()
Machine Learning Mastery with Python - Understand your data, create accurate models and work project...
Java String Conversions