End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
String#eql?
eql?(object) → true or false
string.c
View on GitHub ↗
MJIT_FUNC_EXPORTED VALUE
rb_str_eql(VALUE str1, VALUE str2)
{
if (str1 == str2) return Qtrue;
if (!RB_TYPE_P(str2, T_STRING)) return Qfalse;
return rb_str_eql_internal(str1, str2);
}
Returns true if object has the same length and content; as self; false otherwise:
Example
s = 'foo' s.eql?('foo') # => true s.eql?('food') # => false s.eql?('FOO') # => false
Returns false if the two strings’ encodings are not compatible:
Example
"\u{e4 f6 fc}".encode("ISO-8859-1").eql?("\u{c4 d6 dc}") # => false