From: James Gray Date: 2008-12-10T22:57:53+09:00 Subject: Re: chars method On Dec 10, 2008, at 7:44 AM, Jim McKerchar wrote: > George. If you're not yet ready to move up to a newer version of > Ruby, you could always add a chars method to String..... > > class String > def chars > self.split( "" ) > end > end > > "abcde".chars > => ["a", "b", "c", "d", "e"] Note that your method would probably be better named as bytes() instead of chars(): $ ruby -e 'p "résumé".split("")' ["r", "\303", "\251", "s", "u", "m", "\303", "\251"] If you wanted to support UTF-8 characters, you could replace split("") with scan(/./mu): $ ruby -KUe 'p "résumé".scan(/./mu)' ["r", "é", "s", "u", "m", "é"] I've written about this on my blog quite a bit, if you are interested: http://blog.grayproductions.net/articles/understanding_m17n James Edward Gray II