[ruby-core:77379] [Ruby trunk Feature#12786] String#casecmp?
From:
rringler@...
Date:
2016-09-24 03:02:10 UTC
List:
ruby-core #77379
Issue #12786 has been updated by Ryan Ringler.
Martin D端rst wrote:
> Does it only compare for equality (after case folding)?
Yep. All it would do is check if the return value of `#casecmp` is equal to zero. I'm sure there are plenty of clever uses for `#casecmp`, but I've only ever used it for case-insensitive string comparision. I often find myself monkey-patching this method into `String`.
----------------------------------------
Feature #12786: String#casecmp?
https://bugs.ruby-lang.org/issues/12786#change-60626
* Author: Ryan Ringler
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
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.89 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>