Strings have many available methods. Some of the more commonly used ones are:
- "python".capitalize() == "Python"
- "pYtHOn".upper() == "PYTHON"
- "pYtHOn".lower() == "python"
- "pYtHOn".casefold() == "python"
- "Python".center(10, "*") == "**Python**"
- "Python".ljust(10,"*") == "Python****"
- "Python".rjust(10,"*") == "****Python"
- "abracadabra".count("a") == 5
- "abracadabra".count("ab") == 2
- "Python".endswith("on") == True
- "Python".endswith("in") == False
- "Python".startswith("Py") == True
- "Python".startswith("py") == False
- "favorite".find("or") == 3
- "favorite".find("bob") == -1
- ("or" in "favorite") == True # NOT a method, "in" is an operator
- ("bob" in "favorite") == False # NOT a method, "in" is an operator
- "Bob".replace("B","T").replace("b","m")
- "CIS,111,A-1374,3.0".split(",") == ['CIS', '111', 'A-1374', '3.0']