From: Daniel Brockman Date: 2005-07-10T00:06:38+09:00 Subject: Re: Strings vs arrays Luke Worth writes: > Hi. > > I am wanting to parse large files (of source code) by reading byte by > byte and converting certain patterns into different strings. I can think > of a couple of ways to do this (starting with the source code in a > String): > 1. String#split(//) -> array, then use Array#shift (maybe slow to > convert to array?) > 2. Keep a counter and use String#[] (which seems unrubyish to me) > > Which of these would be preferable? Does anyone know of any better ways? Why not use String#shift, which is O(1)? -- Daniel Brockman