diff options
| author | BurdetteLamar <burdettelamar@yahoo.com> | 2025-12-19 20:06:49 +0000 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2025-12-19 17:09:31 -0500 |
| commit | 42c4df9ac6d5974eac7efddf725ecf39f4c0fd9e (patch) | |
| tree | c59ca0aea6b66c50aebb7aeb81b119b15f8ecb01 /string.c | |
| parent | d540903ee77e81dd1ec3dec744273fbb394238fa (diff) | |
[DOC] Harmonize String#<=>
Diffstat (limited to 'string.c')
| -rw-r--r-- | string.c | 27 |
1 files changed, 15 insertions, 12 deletions
@@ -4294,23 +4294,26 @@ rb_str_eql(VALUE str1, VALUE str2) /* * call-seq: - * self <=> other_string -> -1, 0, 1, or nil + * self <=> other -> -1, 0, 1, or nil * - * Compares +self+ and +other_string+, returning: + * Compares +self+ and +other+, + * evaluating their _contents_, not their _lengths_. * - * - -1 if +other_string+ is larger. - * - 0 if the two are equal. - * - 1 if +other_string+ is smaller. - * - +nil+ if the two are incomparable. + * Returns: + * + * - +-1+, if +self+ is smaller. + * - +0+, if the two are equal. + * - +1+, if +self+ is larger. + * - +nil+, if the two are incomparable. * * Examples: * - * 'foo' <=> 'foo' # => 0 - * 'foo' <=> 'food' # => -1 - * 'food' <=> 'foo' # => 1 - * 'FOO' <=> 'foo' # => -1 - * 'foo' <=> 'FOO' # => 1 - * 'foo' <=> 1 # => nil + * 'a' <=> 'b' # => -1 + * 'a' <=> 'ab' # => -1 + * 'a' <=> 'a' # => 0 + * 'b' <=> 'a' # => 1 + * 'ab' <=> 'a' # => 1 + * 'a' <=> :a # => nil * * Related: see {Comparing}[rdoc-ref:String@Comparing]. */ |
