On Feb 2, 2008, at 5:28 PM, Chris Hickman wrote:
>> irb> (a.split(' ') << nil).each_cons(2) {|word,lookahead| puts "%-10s
>> %s"%[word.inspect,lookahead.inspect]}
>
> Awesome.  I understand how to use it but what exactly does %-10s %s"%
> mean/do?
>
>
> Thanks a lot for the feedback,
>
> chris


That's a way to do formatted output like Kernel.sprintf, but shorter  
to type using String#%

%-10s means a string(s) left-justified(-) in a 10 characters wide  
space (will use more than 10 if the string to be formatted is longer)

%s means a whole string

-Rob

Rob Biedenharn		http://agileconsultingllc.com
Rob / AgileConsultingLLC.com