From: Ammar Ali Date: 2010-11-04T02:25:59+09:00 Subject: Re: UTF-8 aware chop for 1.8? On Wed, Nov 3, 2010 at 7:00 PM, James Edward Gray II wrote: > On Nov 3, 2010, at 11:56 AM, Ammar Ali wrote: > >> My method now looks like: >> >> def chop_utf8(s) >>  return unless s >> >>  lead = s.sub(/.\z/mu, "") >>  last = s.scan(/.\z/mu).first >>  last = '' unless last > > The two lines above can be replaced with the more efficient: > > last = s[/.\z/mu] || '' At this rate the method is going to disappear. :) I updated the gist accordingly: https://gist.github.com/661257 Thanks again, Ammar