Hi,

Tim Chase wrote:
>
[...]
> 
> I broke it out into multiple lines to hopefully make more sense 
> of it.  The first two substitute() lines add a zero on the left 
> of whatever they found, and then take whatever the rightmost two 
> characters of the result are...effectively padding them with 
> zeros on the left if needed.  Ideally, Vim would provide a 
> right() function where you could just do something like
> 
>       right('0'.submatch(1), 2)
> 
> to zero-pad to 2 places.  Alas, the substitute() trick is the 
> easiest way I've found to simulate this.

  repeat('0', 2 - strlen(submatch(1))) . submatch(1)

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us.     (Calvin)

Reply via email to