From: SpringFlowers AutumnMoon Date: 2007-09-26T00:05:18+09:00 Subject: Re: array manipulation Analogy Analogy wrote: > Hi Folks, > > I have a general newbie type question > Say I have a 2D array that I obtained from an external program: > > array = [["a", "b", "", "c", "5"], ["d", "e", "f", "9.0", "7", "g", "", > "", ""], ["", "h", "5", "", ""]] > > > Is there a way to remove just the last two empty strings ("") in the > last element, so the array will look like this: > > array = [["a", "b", "", "c", "5"], ["d", "e", "f", "9.0", "7", "g", "", > "", ""], ["", "h", "5"]] you can use array[2][3,2] = nil to delete the last 2 elements and use flatten to get a new array -- Posted via http://www.ruby-forum.com/.