Method: String#eql?
- Defined in:
- string.c
#eql?(object) ⇒ Boolean
Returns true if object has the same length and content;
as +self+; +false+ otherwise:
s = 'foo'
s.eql?('foo') # => true
s.eql?('food') # => false
s.eql?('FOO') # => false
Returns +false+ if the two strings' encodings are not compatible:
"\u{e4 f6 fc}".encode("ISO-8859-1").eql?("\u{c4 d6 dc}") # => false
4181 4182 4183 4184 4185 4186 4187 |
# File 'string.c', line 4181 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); } |