Project

General

Profile

Actions

Bug #1317

closed

Creating a range with strings

Added by ian (Ian Bailey) over 15 years ago. Updated over 13 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux]
Backport:
[ruby-core:23026]

Description

=begin
irb(main):027:0> Range.new("1", "10").to_a
=> ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
irb(main):028:0> Range.new("2", "10").to_a
=> []

The second result happens when the end of the range is greater numerically but the first character of the start is higher than the first character of the end.

It seems like these two return values are inconsistent. If the range is able to work a list of entries between two integers as strings, it should do it regardless of their first character.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0