DEV Community

Discussion on: Daily Challenge #1 - String Peeler

Collapse
 
ben profile image
Ben Halpern • Edited

Ruby


def remove_first_and_last(string)
  raise "Invalid" if string.size < 3
  string[1..string.size-2]
end
Collapse
 
databasesponge profile image
MetaDave πŸ‡ͺπŸ‡Ί

I think you can get away with string[1..-2] there, Ben.