From: john.slobbe@... Date: 2008-10-20T23:44:43+09:00 Subject: Re: Way to split a string based on fixed length? You can use: string.unpack "A8A8A4A2" # => ["0000000N", "0000000N", "0000", "00"] Regards, John. On 20/10/2008, Wayne Molina wrote: > This is probably a newb question but I can't seem to figure it out. I > have a string I'm trying to parse, that is done via a fixed length > format - it needs to be split on every 8th character in order for me to > get a proper array list of it so I can do some additional operations on > it. > > The string is something like this: '0000000N0000000N0000000N0000000N' > and I need it to be an array containing something like: ['0000000N', > '0000000N', '0000000N', '0000000N']. > > Is there a ruby method I can use to split the single string into groups > of x number of characters, when there is no delimiter? > -- > Posted via http://www.ruby-forum.com/. > >