That looks to be a lot more work than I'd care to do. Whacking off any leading zeros by manipulating the string is probably the quickest and simplest route to go.
Creating a custom formatter is quite beyond my self-taught hobbyist capabilities currently. I'd have to spend a lot of time with a hammer, blow-torch and crowbar55 gallons of lubricant, 40 feet of rubber tubing and a Yak to do some tests on creating one.
My current interests are ones that lie in different directions. Eventually I might wander back and look at creating custom formatters, when dealing with custom class output.
format_to sends it's output to an output buffer iterator rather than returning a string. format-to_n is format_to with the maximum number of characters to be written to the buffer also specified. They both use the same format specifiers as format.