I have a string in Ruby on which I\'m calling the strip method to remove the leading and trailing whitespace. e.g.
s = \"12345 \" s.strip
H
Simply put:
s = s.nil? ? s : s.strip
Tl;dr Check if s is nil, then return s, otherwise, strip it.