The casefold method
The casefold method returns a string in which all characters of the string are in lowercase. We do not specify anything in the method parameter. Unlike the lower method, the casefold method only works with characters in the Unicode encoding.
Syntax
string.casefold()
Example
Let's apply the casefold method to the following line:
txt = 'AbcDef'
print(txt.casefold())
Result of code execution:
'abcdef'
Example
Now let's apply the casefold method to a string consisting of two words:
txt = 'AbWith DeA'
print(txt.casefold())
Result of code execution:
'abwith dea'
See also
-
method
lower,
which returns all lowercase ASCII characters -
method
islower,
which checks the characters of a string for lowercase -
method
swapcase,
which changes the case of characters to the opposite -
method
capitalize,
which changes the first character of a string to uppercase -
method
title,
which changes the first character of each word to uppercase -
method
upper,
which returns all characters of a string in uppercase