Most Used String Functions in Python
String Case Functions
`str.lower()` - Converts all characters to lowercase.
`str.upper()` - Converts all characters to uppercase.
`str.capitalize()` - Capitalizes the first character.
`str.title()` - Capitalizes the first letter of each word.
`str.swapcase()` - Swaps case of all characters.
Search & Check
`str.find(sub)` - Returns lowest index of `sub`, or `-1` if not found.
`str.rfind(sub)` - Like `find()`, but searches from the end.
`str.index(sub)` - Like `find()`, but raises `ValueError` if not found.
`str.startswith(prefix)` - Returns `True` if string starts with `prefix`.
`str.endswith(suffix)` - Returns `True` if string ends with `suffix`.
`str.count(sub)` - Counts how many times `sub` appears.
Check Types
`str.isalpha()` - Checks if all characters are alphabetic.
`str.isdigit()` - Checks if all characters are digits.
`str.isalnum()` - Checks if all characters are alphanumeric.
`str.isspace()` - Checks if all characters are whitespace.
`str.islower()` - Checks if all letters are lowercase.
`str.isupper()` - Checks if all letters are uppercase.
Modify or Clean
`str.strip()` - Removes leading and trailing whitespace.
`str.lstrip()` - Removes leading whitespace.
`str.rstrip()` - Removes trailing whitespace.
`str.replace(old, new)` - Replaces occurrences of `old` with `new`.
Most Used String Functions in Python
Split & Join
`str.split(sep)` - Splits the string into a list by `sep`.
`str.rsplit(sep)` - Splits from the right.
`str.splitlines()` - Splits string at line breaks.
`'sep'.join(list)` - Joins elements of a list into a string with separator `sep`.
Formatting
`str.format()` - Used for string formatting (e.g., `'Hello {}'.format(name)`)
`f'{}'` - f-strings (Python 3.6+), e.g., `f'Hello {name}'`.