P
Peter Bailey
Hi,
This is a pretty simple question. I need to do a "printf" of some
numbers inside a string. I just can't figure out how to express a long
string that has that "printf" inside it, because the printf statement
itself has quotes, too. I just need the number to end up being
zero-padded to 3 characters. So, for "3," I want "003."
number = "3"
puts "stuff, printf "%.3d\n", #{number}"
...compile error...
Thanks,
Peter
This is a pretty simple question. I need to do a "printf" of some
numbers inside a string. I just can't figure out how to express a long
string that has that "printf" inside it, because the printf statement
itself has quotes, too. I just need the number to end up being
zero-padded to 3 characters. So, for "3," I want "003."
number = "3"
puts "stuff, printf "%.3d\n", #{number}"
...compile error...
Thanks,
Peter