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
2.1m questions
2.1m answers
60 comments
57.0k users