#!/usr/bin/env ruby # This code comes from http://ruby-it.org/pages/Eliminare+Tab # Check the page for copyright notice and explanations def expand(stringa, tablen=8) res = [] for substr in stringa.split("\t") res.push substr res.push ' '*(tablen - stringa.size %tablen) end return res.join(' ') end def expand(str, tablen=8) str.split("\t").inject { |a,b| a + ' ' * ( tablen - a.size % tablen ) + b } end