I need to remove newlines at the beginning and at the end of a string in ruby (some sort of trimming).
But JUST at the beginning and the end... The new lines located in the middle of the string must remain untouched.
Thank you!
You can use String#strip method.
"\tgoodbye\r\n".strip #=> "goodbye"