Given a string, I would like to strip it, but I want to have the pre and post removed whitespaces. For example:
my_strip(" hello world ") # => [" ", "hello world", " "]
my_strip("hello world\t ") # => ["", "hello world", "\t "]
my_strip("hello world") # => ["", "hello world", ""]
How would you implement my_strip ?
Solution
Test Suite (RSpec)