# These methods let you search inside strings, split them, and join them back together

message = "Hello Bull"

# in — is something inside the string? Returns True or False
print("Bull" in message)   # True
print("Horn" in message)   # False

# in is case sensitive
print("bull" in message)   # False — "bull" is not "Bull"

# find() — where is it? Returns the index of the first match
print(message.find("Bull"))   # 6
print(message.find("Horn"))   # -1 — not found, no error

# count() — how many times does it appear?
repeat = "bull bull bull"
print(repeat.count("bull"))   # 3

# startswith() — does the string start with this?
print(message.startswith("Hello"))  # True
print(message.startswith("Bull"))   # False

# endswith() — does the string end with this?
print(message.endswith("Bull"))     # True
print(message.endswith("Hello"))    # False

# split() — break it into pieces, returns a list
words = message.split()
print(words)        # ['Hello', 'Bull']
print(words[0])     # Hello
print(words[1])     # Bull

# split() on a specific character
data = "Bull,Horn,Red"
parts = data.split(",")
print(parts)        # ['Bull', 'Horn', 'Red']

# join() — put pieces back together
# Called on the separator, not on the list
words_list = ["Hello", "Bull"]
print(" ".join(words_list))   # Hello Bull
print("-".join(words_list))   # Hello-Bull
print("".join(words_list))    # HelloBull
