Forum: Ruby is there "equalsIgnoreCase" in ruby?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3d4c2229e352a9d0b41ecead595560ca?d=identicon&s=25 viswesh (Guest)
on 2006-05-17 17:40
Hi

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

thanx
31ab75f7ddda241830659630746cdd3a?d=identicon&s=25 Austin Ziegler (Guest)
on 2006-05-17 17:56
(Received via mailing list)
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...

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

-austin
0276239ca57aee241d4b41379587fa20?d=identicon&s=25 Lyle Johnson (Guest)
on 2006-05-17 17:57
(Received via mailing list)
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().
3d4c2229e352a9d0b41ecead595560ca?d=identicon&s=25 viswesh (Guest)
on 2006-05-17 18:46
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().
0276239ca57aee241d4b41379587fa20?d=identicon&s=25 Lyle Johnson (Guest)
on 2006-05-17 18:59
(Received via mailing list)
On 5/17/06, viswesh <visweshwar_03@rediffmail.com> wrote:

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

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
62002cee15efcf4628cd7efc19425a07?d=identicon&s=25 Tim Becker (Guest)
on 2006-05-17 19:03
(Received via mailing list)
> 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
34f159f89cbd1d9beac0276f5a7af552?d=identicon&s=25 John Gabriele (Guest)
on 2006-05-17 19:03
(Received via mailing list)
On 5/17/06, viswesh <visweshwar_03@rediffmail.com> wrote:
> if      fine == "good".casecmp("goo")
>
>


See "ri String#casecmp".
This topic is locked and can not be replied to.