From: Thomas Worm Date: 2007-07-19T21:19:59+09:00 Subject: Re: identify and extract positions from a string - how to? On Thu, 19 Jul 2007 14:04:13 +0200, F. Senault wrote: > Le 19 juillet à 13:54, Thomas Worm a écrit : > >> Those ..-things are called ranges, which, what wonder, are a class in >> ruby. Have a look at http://corelib.rubyonrails.org/ for the class >> Range. >> >> another way to express str[45..78] is str[45,78] > > Nope : > >>> str[45..78].length > => 34 >>> str[45,78].length > => 78 > > (IOW start_position..end_position versus start_position,length.) > I guess you are right. I misintepreted the documentation, which says in a number of examples: a = "hello there" a[1,3] #=> "ell" a[1..3] #=> "ell" I should have taken the time to read the text instead. Thomas