On Jun 25, 6:25 am, tobie <[EMAIL PROTECTED]> wrote:
> 'a982k298e863q982'.split(/(.{4})/).without('') is the only thing I can
> think of for now using split
>
> The other solution being of course:
>
> 'a982k298e863q982'.toArray().inGroupsOf(4).invoke('join', '')
It seems much simpler to use the native String.prototype.match method:
'a982k298e863q982'.match(/\w{4}/g);
--
Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---