defremove_first_and_last(some_string)raise'Not long enough'unlesssome_string.length>2some_string[1..-2]end
Extra
defremove_first_and_last_n_characters(some_string,chars_to_remove: 1)raise'Not long enough'unlesssome_string.length>(chars_to_remove*2)start_index=chars_to_removeend_index=-1-chars_to_removesome_string[start_index..end_index]end
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Ruby
Basic
Extra