wp.jochen.hayek.name/blog-en

XQuery: padding an integer or a number, but not with “0”

I found this function, but it pads on the right:

I derived pad-string-to-length-on-the-left from it:

I use it around format-integer and format-number, e.g.

let $net_amount_formatted := local:pad-string-to-length-on-the-left( format-number( data($invoice/@net_amount) , '#,###.#####' ) , ' ' , 12 )
Exit mobile version