From: 7stud -- Date: 2011-09-17T08:20:46+09:00 Subject: Re: array.map! + delete_if possible ? Kassym Dorsel wrote in post #1022385: > > (0..arr.size).each do |i| > arr = [1, 2, 3] (0..arr.size).each do |index| p arr[index] end --output:-- 1 2 3 nil > if arr[i].to_i == 1201 > arr[i]=arr[i].to_s[8..-1].gsub(/"[^"]*"/,'::').gsub(/".*/,"::") > else > arr[i-1] = arr[i-1] + arr[i].to_s[4..-1].to_s.gsub(/\s*/,"") > arr[i]=nil > end > end > What if the first string in the array doesn't equal 1201? -- Posted via http://www.ruby-forum.com/.