As far as I can tell, this is the correct way to do case-insensitive string comparison in Ruby:
if string1.casecmp(string2) == 0 # strings match, ignoring case end
That’s so ugly, it almost looks like Java. Actually, it’s worse than Java, which has String#equalsIgnoreCase.
We need to do that for Mojo too as .NET creates the hex digest in upper case =/
Comment by Robbie — 8 November 2007 @ 2:19 pm
Yeah yeah, already done :-) – that’s where I found it.
Comment by Kerry — 8 November 2007 @ 3:02 pm
This looks better to me:
string1.downcase == string2.downcase
Comment by Brian Marick — 8 November 2007 @ 3:18 pm
You could use regular expressions:
string1 =~ /^string2$/i
Comment by Alkesh — 12 November 2007 @ 4:00 pm