Re: Equivalent of Python zfill?

fr Peter:

But if “0”*7 is the ‘normal’ way of doing this, it’s OK with me.

in ruby in general, the shorter and simpler, the faster.

kind regards -botp

On 5/29/06, Peña, Botp [email protected] wrote:

fr Peter:

But if “0”*7 is the ‘normal’ way of doing this, it’s OK with me.

in ruby in general, the shorter and simpler, the faster.

kind regards -botp

it might be worth profiling something like this:

at start of code

lotsazeros = ‘0’ * 1000

various places in code

seven_zeros = lotsazeros[0…6]
three_thousand_and_ten_zeros = lotsazeros * 3 + ‘0’ * 10

no idea how this performs, just thought it’d be worth trying…

;D