From: Robert Klemme Date: 2004-04-22T04:54:09+09:00 Subject: Re: printf / indent "Gennady" schrieb im Newsbeitrag news:4086BE43.1000606@tonesoft.com... > Its Me wrote: > > > How can I control starting (left) indentation for printf? Pickaxe did not > > yield an answer. Or do I have to loop putting out spaces with > > IO#putc " "? > > > > Thanks! > > > > > > > I would do > > indent = 3 > message = "Hello, world" > printf "%#{indent}s%s\n", "", message > > or > > indent = 3 > message = "Hello, world" > printf "#{' '*indent}%s", message printf style is rather this: irb(main):007:0> printf "%*d", 10, 5 5=> nil irb(main):008:0> printf "%*d", -10, 5 5 => nil robert