From: Dan Doel Date: 2003-11-15T11:32:38+09:00 Subject: Re: substring: to the end of the string Some ways: class String def substring1(n) reg = Regexp.compile("(^" + "."*n + ")(.*)\\z") reg.match(self)[2] end def substring2(s, e=-1) self[s..e] end end p "12345".substring1 1 p "12345".substring1 2 p "12345".substring2 1 p "12345".substring2 2 p "12345".substring2 1, 3