ref: addfe6e58b518046d3ed84e6b6081f1538946c3a
parent: 8672ce0c95bf5d6e6b721694bd0e5944d4af556b
author: Ori Bernstein <[email protected]>
date: Sun Oct 1 14:58:49 EDT 2017
Add '{b=} option to print integers. It outputs in base b <= 36.
--- a/lib/std/fmt.myr
+++ b/lib/std/fmt.myr
@@ -481,11 +481,13 @@
]
opts = parseparams(params, [
+ ("b", true),
("x", false),
("w", true),
("p", true)][:])
for o : opts
match o
+ | ("b", bas): ip.base = getint(bas, "fmt: base must be integer")
| ("x", ""): ip.base = 16
| ("w", wid): ip.padto = getint(wid, "fmt: width must be integer")
| ("p", pad): ip.padfill = decode(pad)