From: "Jean-François Trân" Date: 2008-03-26T08:58:27+09:00 Subject: Re: golf: tabs to bullets 2008/3/25, David A. Black : > Darn, I took you literally :-) > > def t(s)b='*-ox';s.map{|l|c=l.count("\t") > (c-1).times{l.sub!(/\t/,' ')} > l.sub(/\t/,b[c-1,1])}end > > t(some_string) You forgot the modulo : with c = l.count("\t')-1, it gives : def t(s)b='*-ox';d=b.size;s.map{|l|c=l.count("\t")-1 c.times{l.sub! /\t/,' '} l.sub /\t/,b[c%d,1]}end input : input = <