String Methods
Strings implement all of the common sequence operations, along with additional methods such as case validation and conversion.
string = "Test"
print("string:", string)
print("string.isalpha():", string.isalpha())
print("string.islower():", string.islower())
print("string.isnumeric():", string.isnumeric())
print("string.isspace():", string.isspace())
print("string.istitle():", string.istitle())
print("string.isupper():", string.isupper())
print("string.lower():", string.lower())
print("string.strip():", string.strip())
print("string.swapcase():", string.swapcase())
print("string.title():", string.title())
print("string.upper():", string.upper())
Output:
string: Test
string.isalpha(): True
string.islower(): False
string.isnumeric(): False
string.isspace(): False
string.istitle(): True
string.isupper(): False
string.lower(): test
string.strip(): Test
string.swapcase(): tEST
string.title(): Test
string.upper(): TEST