From: "Ara.T.Howard" Date: 2005-08-10T12:20:07+09:00 Subject: Re: NEWBIE QUESTION: pattern with nil On Wed, 10 Aug 2005, David A. Black wrote: > Hi -- > > On Wed, 10 Aug 2005, basi wrote: > >> Hello, >> I'm a bit tired typing: >> >> if a == "" or a == nil >> if a != "" and a !== nil >> >> I'm sure there is a Ruby way to do this. > > You can normalize it to a string: > > if a.to_s.empty? > > or, for the opposite: > > unless a.to_s.empty? 'normalize' is such a nicer word than 'cast' - i'll take it! -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | Your life dwells amoung the causes of death | Like a lamp standing in a strong breeze. --Nagarjuna ===============================================================================