Advertisement
# Signature of casefold() method
casefold()
# Python - Method casefold() Example
# Creating a string
s1 = ('SUN - The brightest star in our Solar System.')
# Printing the original string
print('Value of string : ', s1)
# Calling the casefold() method on string object
print('Calling the casefold() method on string : ', s1.casefold())
Value of string : SUN - The brightest star in our Solar System.
Calling the casefold() method on string : sun - the brightest star in our solar system.
# Python - Method casefold() Example
# Creating a string
s1 = ('MARS - The Red Planet')
# Printing the original string
print('Original string before calling casefold() : ', s1)
# Calling the casefold() method on string object
print('Calling the casefold() method : ', s1.casefold())
# Printing the original string
print('Original string after calling casefold() : ', s1)
String's value : Jupiter - MARS - The Red Planet
Calling the casefold() method : jupiter - mars - the red planet
Original string after calling casefold() - mars - the red planet
Advertisement
# Python - casefold() method example.
# Creating a string
s = 'Work Hard To Achieve Your Dreams'
# Printing the original string
print('String value : ', s)
# Result of calling casefold() is made to reference by the reference of original string.
s = s.casefold()
# Old reference variable pointing to the new string
print('String value after casefold() : ', s)
String value : Work Hard To Achieve Your Dreams
String value after casefold() : word hard to achieve your dreams
Advertisement
Advertisement
Please check our latest addition
C#, PYTHON and DJANGO
Advertisement