On Sunday 24 October 2004 09:32 am, Simon Strandgaard wrote:
| class String
|  def first(n=nil)
      n = (n || 1).to_i
|   raise ArgumentError, "negative string size" if n < 0
|   n = [n, self.size].min
|   self[0, n]
|  end
|  def last(n=nil)
      n = (n || 1).to_i
|   raise ArgumentError, "negative string size" if n < 0
|   n = [n, self.size].min
|   self[-n, n]
|  end
| end

Would you say that's better, or no?

Thanks,
T.