SHARE
TWEET

Untitled

a guest Jul 21st, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def remove_first_and_last_letters(str)
  2.   return '' if str.length <= 2
  3.   str[1..-2]
  4. end
  5.  
  6. puts remove_first_and_last_letters('foo')
  7. puts remove_first_and_last_letters('hi')
  8. puts remove_first_and_last_letters('x')
  9. puts remove_first_and_last_letters('xHello, world!D')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top