From: Alex Young Date: 2007-04-27T18:57:20+09:00 Subject: Re: php's chunk_split alternative in ruby Mister Twister wrote: > hello, > how could I chunk_split string > > mylongstring = "some long long long string" > > into smaller strings of length 3. > > In PHP it is > > chunk_split(mylongstring,3); > irb(main):005:0> "some long long long string".scan(/.{1,3}/) => ["som", "e l", "ong", " lo", "ng ", "lon", "g s", "tri", "ng"] Like that? If not, you'll need to give an example of the output you're trying to achieve (which is generally a good idea anyway...). -- Alex