Is there "equalsIgnoreCase" in ruby?

Hi

Please let me know whether any method similar to ("equalsIgnoreCase" in
java)
exists in ruby as well...

thanx

···

--
Posted via http://www.ruby-forum.com/.

What does equalsIgnoreCase do, and could you not have spent five
minutes to Google?

-austin

···

On 5/17/06, viswesh <visweshwar_03@rediffmail.com> wrote:

Please let me know whether any method similar to ("equalsIgnoreCase" in
java)
exists in ruby as well...

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

Yes, it's called String#casecmp().

···

On 5/17/06, viswesh <visweshwar_03@rediffmail.com> wrote:

Please let me know whether any method similar to ("equalsIgnoreCase" in
java)
exists in ruby as well...

Hi Johnson,

can u please correct the code...

puts " what is your name"
name = gets.chomp

puts " hello "+ name+" how are you"
fine = gets.chomp

if fine == "good".casecmp("goo")
  #fine == "fine" or
  #fine == "ok" or
  #fine == "wonderfull"
puts " great"
else
  puts "oh iam sorry"
end

thanx

Lyle Johnson wrote:

···

On 5/17/06, viswesh <visweshwar_03@rediffmail.com> wrote:

Please let me know whether any method similar to ("equalsIgnoreCase" in
java)
exists in ruby as well...

Yes, it's called String#casecmp().

--
Posted via http://www.ruby-forum.com/\.

I think that maybe you mean to write:

    if fine.casecmp("good")
      puts "Great!"
    else
      puts "Oh, I'm sorry."
    end

Hope this helps,

Lyle

···

On 5/17/06, viswesh <visweshwar_03@rediffmail.com> wrote:

if fine == "good".casecmp("goo")
        #fine == "fine" or
        #fine == "ok" or
        #fine == "wonderfull"

See "ri String#casecmp".

···

On 5/17/06, viswesh <visweshwar_03@rediffmail.com> wrote:

Hi Johnson,

can u please correct the code...

puts " what is your name"
name = gets.chomp

puts " hello "+ name+" how are you"
fine = gets.chomp

if fine == "good".casecmp("goo")
        #fine == "fine" or
        #fine == "ok" or
        #fine == "wonderfull"
puts " great"
else
  puts "oh iam sorry"
end

thanx

can u please correct the code...

you forgot to tell us what you want the program to do, what it's
doing instead, the things you've already tried to remedy the problem
and what you think might be the problem.
  -tim