From: Tony Arcieri Date: 2009-03-05T06:42:26+09:00 Subject: Re: Any solutions to Ruby's inconsistencies? --0015174c352c57e462046451f207 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Wed, Mar 4, 2009 at 2:32 PM, C. Dagnon wrote: > Yossef Mendelssohn wrote: > > key = map.keys.detect { |k| k.to_s.downcase == matcher.to_s.downcase > } > > Hmmm, what is 'detect'? > > I had been doing that, but then I thought that compiling a single regex > would be less expensive than downcasing everything every time they got > compared. You can also use String#casecmp to avoid making a new downcased string object each time you do the comparison, e.g. matcher.casecmp(k.to_s).zero? -- Tony Arcieri --0015174c352c57e462046451f207--