From: Gavin Sinclair Date: 2003-01-14T13:31:12+09:00 Subject: Re: RCR: String#indent(n) On Tuesday, January 14, 2003, 3:16:03 PM, Joel wrote: > Gavin Sinclair wrote: >> Rubyists, >> >> I think a fine companion for String#ljust, String#rjust and >> String#center would be String#indent. > It's pretty easy to just use gsub instead: > text.gsub(/^/, " "*4) > whereas ljust, rjust, and center would require a little more work to > emulate with gsub. Or do you have more functionality in mind? No more, and I realised the gsub trick just after I hit send. Ease of implementation alone doesn't discount an idea, though :) > Just for the heck of it, here are some bits I use from time to time. > They might fit in some kind of string formatting library. Those are good. There's a place on the Wiki for these. Is it StandardClassExtensions? If you don't add them, I will (when I get around to it). Cheers, Gavin