DEV Community

loading...

Discussion on: Daily Challenge #1 - String Peeler

Collapse
scrabill profile image
Shannon Crabill

I liked today's challenge so I'm going back to do past ones

def string_peeler(string)
  if string.length > 2
    string.delete(string[0]).delete(string[-1])
  end
end

Returns

string_peeler("hi") => nil 
string_peeler("killer") => "ille" 
string_peeler("BOB") => "O"