On Thu, Aug 14, 2008 at 11:21:10PM +0900, Lorenzo E. Danielsson wrote:
> 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? 

str[index..index] = ""

> Lorenzo
--Greg