From: Austin Ziegler Date: 2003-10-29T00:54:03+09:00 Subject: Re: Formatting (ANSI) highlighted strings On Tue, 28 Oct 2003 17:32:13 +0900, Gavin Sinclair wrote: > Using the 'text/highlight' package on RubyForge, you can emit coloured > strings to the console like so: > s = "string".bold.red.on_white > Great. Now if I want to format that using: > printf "%-10s goes here\n", s > I'm not going to get (in B&W) > string goes here > Rather > string goes here > Because > s.size > 10 # It contains escape sequences to enact colours. > even though it only contains 6 printable characters. > Does anyone have any alternative, or a bright idea? s = "string".ljust(10).bold.red.on_white ? -austin -- austin ziegler * austin@halostatue.ca * Toronto, ON, Canada software designer * pragmatic programmer * 2003.10.28 * 10.50.55