From: "NAKAMURA, Hiroshi" Date: 2002-03-27T18:16:46+09:00 Subject: Re: Weird problem with Ruby debugger Hi, > From: Dennis Newbold [mailto:dennisn@pe.net] > Sent: Saturday, March 23, 2002 7:12 AM > > FYI: $= is obsolete in Ruby. > So, if the $= variable is obsolete, can anybody tell me what is the > approved or recommanded way of doing a case-insensitive comparison of > two strings, or of getting the Array#include? method to do a case > insensitive comparison, as in: > > ["built-in-command-1", "built-in-command-2"].include? response It might not be a recommended way but how is this? # DEBT: An element must be a String. class StringArray < Array end class CaseInsensitiveStringArray < StringArray def include?( target ) each { | ele | return true if ele.upcase == target.upcase } end end p CaseInsensitiveStringArray["built-in-command-1", "built-in-command-2"].include?( "Built-In-Command-2" ) Hope this helps, // NaHi