On Sep 20, 2010, at 12:10 PM, F. Senault wrote:

> The method takes one argument, an array containing a sorted list of
> strings representing episodes numbers.  The episodes numbers are either
> a number ('1', '12') or prefixed with a letter ('S1' for special 1).  My
> goal is to find sequences in the numbers and join them with dashes :
> 
>>> RAniDBTools.format_episodes_list([ '1', '2', '3', '4', '6', '7', '9', 'S1', 'S2' ])
> => "1-4, 6-7, 9, S1-S2"
>>> RAniDBTools.format_episodes_list([ '1', '2', 'S3', 'S4', 'S5', 'O6' ])
> => "1-2, S3-S5, O6"

Dave Thomas and I were playing around with an idea like this recently:

  http://gist.github.com/570434

  http://gist.github.com/570556

I hope those give you some fresh ideas.