Strings In Depth12 / 19
Up next

Trim

messy = "   padded   "
# strip trims whitespace from both ends
p messy.strip
# chomp removes a trailing newline
p "line\n".chomp
What you're solving

strip and chomp