From: "ara.t.howard" Date: 2008-08-15T02:19:19+09:00 Subject: Re: Idiom of removing a particular character from a String? On Aug 14, 2008, at 8:21 AM, Lorenzo E. Danielsson wrote: > Hi all, > > Is there any particular idiom for removing a particular character > from a > string *by index* and returning the resulting string? The following > makes my old eyes sore: > > rem = str.clone > rem[i] = "" > rem > > as does this: > > rem = str.scan(/./) > rem.delete_at(i) > rem.to_s > > It seems there should be some more idiomatic way to do this, something > like str.annihilate_char_at_index_possibly_without_a_bang(i), read as > String#delete_at(i) and String#delete_at!(i). Of course these methods > don't exist, and "".methods doesn't turn up anything interesting. So > what is a *decent* way of performing this? > > Lorenzo don't do it by index string.tr! chars, '' a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama