diff options
author | duerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-29 10:45:54 +0000 |
---|---|---|
committer | duerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-29 10:45:54 +0000 |
commit | dacf977a42b7268cc752fe0b3b521d39ab7b05e9 (patch) | |
tree | 0f87c6b5530a06c6138892cb8b82f4b4d54f8a2d | |
parent | fa7066f81839060d0a49f674625e6382233dcd3d (diff) |
Fix/improve documentation of String/Symbol#casecmp[?]
Fix documentation of String#casecmp? (examples didn't have the '?').
Add an example with non-ASCII characters. Clarify that casecmp,
unlike casecmp?, only does case-insensitivity on A-Z/a-z.
[ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | string.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -3130,6 +3130,8 @@ rb_str_cmp_m(VALUE str1, VALUE str2) * str.casecmp(other_str) -> -1, 0, +1 or nil * * Case-insensitive version of <code>String#<=></code>. + * Currently, case-insensitivity only works on characters A-Z/a-z, + * not all of Unicode. This is different from <code>casecmp?</code>. * * "abcdef".casecmp("abcde") #=> 1 * "aBcDeF".casecmp("abcdef") #=> 0 @@ -3202,10 +3204,11 @@ rb_str_casecmp(VALUE str1, VALUE str2) * Returns true if str and other_other_str are equal after Unicode case folding, * false if they are not equal, and nil if other_str is not a string. * - * "abcdef".casecmp("abcde") #=> false - * "aBcDeF".casecmp("abcdef") #=> true - * "abcdef".casecmp("abcdefg") #=> false - * "abcdef".casecmp("ABCDEF") #=> true + * "abcdef".casecmp?("abcde") #=> false + * "aBcDeF".casecmp?("abcdef") #=> true + * "abcdef".casecmp?("abcdefg") #=> false + * "abcdef".casecmp?("ABCDEF") #=> true + * "äöü".casecmp?("ÄÖÜ") #=> true */ static VALUE @@ -9637,6 +9640,8 @@ sym_cmp(VALUE sym, VALUE other) * sym.casecmp(other) -> -1, 0, +1 or nil * * Case-insensitive version of <code>Symbol#<=></code>. + * Currently, case-insensitivity only works on characters A-Z/a-z, + * not all of Unicode. This is different from <code>casecmp?</code>. */ static VALUE |