From: "Brian Schröder" Date: 2004-11-08T21:50:42+09:00 Subject: Re: Succ distance between two strings On Sat, 6 Nov 2004 23:07:59 +0900 "David A. Black" wrote: > Hi -- > > On Sat, 6 Nov 2004, trans. (T. Onoma) wrote: > > > > > Is there an efficient way to calculate the "succ distance" between two strings > > (without iterating over each succession)? Examples: > > > > 'a'..'a' 0 > > 'a'..'b' 1 > > 'a'..'z' 25 > > 'a'..'aa' 26 > > 'a'...'aa'.to_a.size # would be one way That does not work, as the ... have a very low binding. It seems a common error I made often. bschroed@black:~ $ irb irb(main):001:0> 'a'...'aa'.to_a.size => "a"...1 irb(main):002:0> ('a'...'aa').to_a.size => 26 Regards, Brian -- Brian Schr�der http://www.brian-schroeder.de/