In Ruby there is this neat little method String#start_with? that takes in as many prefixes as you want, and returns true if the string starts with any of them.
greeting = "hello there" greeting.start_with?("general", "kenobi") # => false greeting.start_with?("heaven", "hell") # => true
- Case sensitive
- Accepts regular expressions