I want apple and Apple comparison to be true. Currently
apple
Apple
true
"Apple" == "Apple" # returns TRUE "Apple" == "APPLE" # returns FALSE
You're looking for casecmp. It returns 0 if two strings are equal, case-insensitively.
casecmp
0
str1.casecmp(str2) == 0 "Apple".casecmp("APPLE") == 0 #=> true
Alternatively, you can convert both strings to lower case (str.downcase) and compare for equality.
str.downcase
1.4m articles
1.4m replys
5 comments
57.0k users