1. capitalize() : capitalize() method converts first character of a string to uppercase letter.The capitalize() function returns a string with the first letter capitalized and keep other characters lowercased. It doesn't modify the original string.
a = "nuv" print(a) b = a.capitalize() print(b)Output :
2. center() : center() method returns a string which is filled with the specified character.
a = "nUV" print(a) b = a.center(24) print(b)Output :
3. count() : count() method returns the number of occurrences of a substring in the given string.
a = "My name is is" b = a.count("is") print(b)Output :
4. casefold() : casefold() method converts all teh characters of given string into lowercase.
a = "Hello NUV" b = a.casefold() print(b)Output :
5. find() : find() method finds the first occurrence of the specified value.The find() method returns -1 if the value is not found.
a = "This is very good concept" b = a.find("is") print(b)Output :
6. index() : index() method(same as find() method) finds the first occurrence of the specified value.The index() method raises error if the value is not found.
a = "This is very good concept" b = a.index("is") print(b)Output :
7. isalnum() : isalnum() method returns True if all characters in the string are alphanumeric (either numbers or alphabets). returns False otherwise.
a = "Thisis007" b = a.isalnum() print(b)Output :
8. isalpha() : isalpha() method returns True if all characters in the string are alphabets. returns False otherwise.
a = "Thisis" b = a.isalpha() print(b)Output :
9. isdigit() : isdigit() method returns True if all characters in the string are digits. returns False otherwise.
a = "007" b = a.isdigit() print(b)Output :
10. isupper() : isupper() method returns True if all characters in the string are in uppercase. returns False otherwise.
a = "HI HELLO" b = a.isupper() print(b)Output :
11. islower() : islower() method returns True if all characters in the string are in lowercase. returns False otherwise.
a = "hi hello" b = a.islower() print(b)Output :
12. lower() : lower() method converts all the characters of a given string into lower case.
a = "HiHello" b = a.lower() print(b)Output :
13. upper() : upper() method converts all the characters of a given string into upper case.
a = "hihello" b = a.upper() print(b)Output :
14. isprintable() : isprintable() checks whether all the characters of the given string is printable or not.
a = "hihello" b = a.isprintable() print(b)Output :