It would be nice if Decimal types implemented the fmt.Formatter interface to allow the use of standard fmt verbs/flags when formatting decimals to strings.
For example:
fmt.Printf("%.2f", decimal.RequireFromString("3.14"))
Would be equivalent to:
fmt.Printf("%s", decimal.RequireFromString("3.14").StringFixed(2))
There are a number of other verbs/flags that could be implemented which can be seen here
It would be nice if
Decimaltypes implemented thefmt.Formatterinterface to allow the use of standardfmtverbs/flags when formatting decimals to strings.For example:
Would be equivalent to:
There are a number of other verbs/flags that could be implemented which can be seen here