# String methods are built-in tools that come with every string
# You call them with a dot: string.method()

name = "  Bull  "

# len() — how long is the string?
# Note: len() is a function, not a method — it wraps the string
print(len("Bull"))   # 4

# upper() — everything uppercase
print(name.strip().upper())  # BULL

# lower() — everything lowercase
name_upper = "BULL"
print(name_upper.lower())    # bull

# strip() — remove spaces from both ends
name_spaces = "  Bull  "
print(name_spaces.strip())   # Bull

# lstrip() — remove spaces from the left only
print(name_spaces.lstrip())  # "Bull  "

# rstrip() — remove spaces from the right only
print(name_spaces.rstrip())  # "  Bull"

# replace() — swap one thing for another
phrase = "Bull Horn"
print(phrase.replace("Horn", "Red"))  # Bull Red

# replace() all occurrences
repeat = "bull bull bull"
print(repeat.replace("bull", "BULL")) # BULL BULL BULL

# Methods don't change the original string — they return a new one
original = "bull"
new = original.upper()

print(original)  # bull — unchanged
print(new)       # BULL

# Methods can be chained — Python reads left to right
messy = "  bull  "
print(messy.strip().upper())  # BULL
