From: Simon Strandgaard <0bz63fz3m1qt3001@...> Date: 2003-06-01T04:58:33+09:00 Subject: Re: expandtabs On Sun, 01 Jun 2003 05:04:51 +0900, Josef 'Jupp' Schugt wrote: > > The equivalents for method2 and method3 are obvious. Does anybody > have a better solution that does not require splitting and re-joining > (which is time-consuming)? How about this: def expand_tabs(data, indent=8) x = 0 i = 0 while i < data.length case data[i] when 9 add = indent - (x % indent) data[i..i] = '.'*add x += add i += add when 10 x = 0 i += 1 else x += 1 i += 1 end end data end text = <