Subject: Re: get a portion of a utf8 encoded string
From: Daniel DeLorme <dan-ml@ n . m
Date: Wed, 17 Sep 2008 13:11:48 +0900
References: 315037315039
In-reply-to: 315039
Heesob Park wrote:
> You can do it using regular expression :
>
> 'hllo'.split(//u)[0, 2].to_s -> h
Why make it convoluted when ruby makes it so easy to use regexps:
>> puts 'hllo'[/.{2}/um]
h