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
Ruby 2.3.0 added a safe navigation operator (&.) that checks for nil before calling a method.
&.
s&.strip
If s is nil, this expressions returns nil instead of raising NoMethodError.
s
nil
NoMethodError