--- Jos Backus <josb / cncdsl.com> wrote:
> >    String       ext      ext2
> >    ======       ===      ====
>      a
>      a-b          b
>      a-b-c        b-c      c
>      a-b-c-d      b-c-d    c-d

Seems to me that from a clarity standpoint, I would create
a method that I could invoke like this:

  ext = after_dash('a-b-c-d')
  ext2 = after_dash(ext)

Here are a couple working (but not optimized)
implementations:

def after_dash(text)
    result = Regexp.new('.*?-').match(text)
    return result ? result.post_match : ''
end

def after_dash(text)
    result = text.index('-')
    return result ? text[result+1..-1] : ''
end

Fewest lines of code? No, and proud of it.

Fastest execution? No, because premature optimization is
evil.

Testable? Yes. 
Reusable? Yes. 
Maintainable? Yes.

Could be further improved? Most likely.

Kevin


__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1