From: Christian Neukirchen Date: 2005-03-19T20:04:17+09:00 Subject: Re: Iterating through a string and removing leading characters Florian Gross writes: > Randy Kramer wrote: > >> * ?? (Is there any method which chops the first character from >> the string? How efficient is that (especially compared to the >> method described in the next bullet). > > str.slice!(0) > > I think this is actually fairly efficient, but I suppose there's a > memmove involved at the C level. > > Perhaps you could set the characters you don't need to '\0' and remove > all of them after the iteration has ended with a Regexp? Better use String#delete! for that, no? -- Christian Neukirchen http://chneukirchen.org