Josh Cheek wrote in post #1011386:
> On Mon, Jul 18, 2011 at 7:52 AM, raju sathliya
> <raju.sathliya / gmail.com>wrote:
>
>>
>> Thanks,
>> raju
>>
>> --
>> Posted via http://www.ruby-forum.com/.
>>
>>
> You want printf http://ruby-doc.org/core/classes/IO.html#M000894 There
> is a
> breakdown of everything it can do on sprintf
> http://ruby-doc.org/core/classes/Kernel.html#M001432
>
> In this particular case, it would be `printf('%03d', val)`

Thanks Josh for reply !
But for variable it gives me below error

test2.rb:46: syntax error, unexpected ',', expecting ')'
sprintf ('%03d',"#{num}")
                ^
test2.rb:46: syntax error, unexpected ')', expecting $end

Do you have any solution for this please

-- 
Posted via http://www.ruby-forum.com/.