Looks really nice. There are several packages that have been dipping into the guts of Base.Grisu, this looks like a promising alternative.
--Tim On Friday, November 21, 2014 12:48:35 AM Tony Fong wrote: > I just wrote a package that may do what you need in runtime. > > https://github.com/tonyhffong/NumFormat.jl > > It's not in METADATA yet, since I'm not sure if its implementation is > kosher. (There's a trick of generating new generic functions at runtime > within the module name space). > > Speed is decent (within 30% of standard macro). You can run the test script > to see the difference on your machine. > > After you clone it, you can try > > using NumFormat > > format( 12345678, commas=true) # method 1. slowest, but easiest to change > format in a readable way > > sprintf1( "%'d, 12345678 ) # method 2. closest to @sprintf in form, so one > can switch over quickly > > f = generate_formatter( "%'d" ) # method 3. fastest if f is used repeatedly > f( 12345678 ) > > Tony > > On Saturday, November 8, 2014 6:05:08 PM UTC+7, Arch Call wrote: > > How would I use a @printf macro to use commas for thousands separators in > > integers? > > > > @printf "%d \n" 12345678 > > > > This outputs: 12345678 > > > > I would like the output to be: 12,345,678 > > > > Thanks...Archie