As there are more than 40 methods for strings, we will cover some of the most commonly found methods here. However, the full list can be found in the Python documentation:
- str.capitalize(): Returns a copy of the string with only the first character capitalized and all others lowercase.
- str.endswith(suffix[, start[, end]]): Returns True if the string ends with the specified suffix; otherwise, returns False. To look for multiple suffixes, a tuple can be used. The optional start is the index to start the search at, and the optional end is the ending index.
- str.format(*args, **kwargs): Conducts a string formatting operation. This has been shown previously in other examples. There are many additional parameters that can be used ...