Case-insensitive string compare?

Have you tried a trailing i?

irb(main):001:0> ‘Ruby’ =~ /^ruby$/i
irb(main):002:0> ‘Ruby’ =~ /^ruby$/

If you want to be more verbose then look at e.g.

irb(main):003:0> ‘Ruby’ =~‘ruby’, Regexp::IGNORECASE)

Hope this helps,



In article, Russ Freeman wrote:

Hi folks, can’t seem to find a straight answer to this.

I expected to find something like “String.compareNoCase” with no luck. I’m
assuming I don’t need to use either downcase explicitly or that horrid
global, $=, to achive the same result ? | The “`Stok’ disclaimers” apply. | GPG PGP Key 1024D/059913DA | Fingerprint 0570 71CD 6790 7C28 3D60 | 75D2 9EC4 C1C0 0599 13DA