From: David Gustafson Date: 2012-05-01T01:17:46+09:00 Subject: Re: delete character from array On Mon, Apr 30, 2012 at 8:33 AM, Ok Ok wrote: > Yes that was exactly it. I have one more question maybe you can help me > with. Is there a way I could delete every 3rd letter in a string? > > -- > Posted via http://www.ruby-forum.com/. > If it was an array you were talking about the index of the letter you want to delete would be (index + 1) % 3). In pry or irb enter: a = (1..20).to_a a.select{|item| (item + 1) % 3 == 0} So by that logic: [8] pry(main)> b = "0123456789".bytes => # [9] pry(main)> b.select{|item| (item + 1) % 3 == 0} => [50, 53, 56] [10] pry(main)> b.select{|item| (item + 1) % 3 == 0}.each {|c| puts c.chr} 2 5 8 => [50, 53, 56] -- Doubt is not a pleasant condition, but certainty is absurd.         -- Voltaire