Issue #12786 has been updated by Ryan Ringler.


Thank you for incorporating this!

I see the changeset implements the new method by calling `String#downcase` on both strings and compares the results for equality.  While this does allow unicode support in advance of `String#casecmp`, it sacrifices the performance of character-by-character comparison that `#casecmp` provides.  It's also going to lead to some inconsistent behavior:

```
'äöü'.casecmp('').zero? # false
''.casecmp?('')      # true
```


I hope this was considered, and perhaps when `String#casecmp` provides better support for unicode we can update `#casecmp?` to use it.

----------------------------------------
Feature #12786: String#casecmp?
https://bugs.ruby-lang.org/issues/12786#change-61781

* Author: Ryan Ringler
* Status: Closed
* Priority: Normal
* Assignee: Martin Drst
----------------------------------------
Description

I would find String#casecmp? convenience method handy.  I don't believe I've ever called String#casecmp without chaining #zero? to the result.

```ruby
'abc'.casecmp?('ABC') #=> true
'abc'.casecmp?('DEF') #=> false
```

---Files--------------------------------
string_casecmp_.patch (4.97 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>