instance method
String#eql?
(untyped other) -> bool
eql?(object) → true or false
string.c
View on GitHub ↗
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 whether self and object have the same length and content:
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
s0 = "äöü" # => "äöü" s1 = s0.encode(Encoding::ISO_8859_1) # => "\xE4\xF6\xFC" s0.encoding # => #<Encoding:UTF-8> s1.encoding # => #<Encoding:ISO-8859-1> s0.eql?(s1) # => false
See Encodings.
Related: see Querying.