-
Notifications
You must be signed in to change notification settings - Fork 623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement fmt.Formatter #326
Comments
That would be an amazing addition to the library, thanks for the suggestion! :3 I won't be able to implement it before the 1.4 release, but I will add it to the backlog. Thanks! |
* Fixes shopspring#326 * We would like to get started implement the fmt.Formatter. * At first, we implement the indicators of '%s' and '%f'.
@mwoss Hi, I've interested in this issue. Indeed, we would be good as if we used
Second, the concept of the Decimal's places, it can be placed with a negative number but what should we represent a negative number on the format indicator? |
Hi @u5surf! Thanks for working on this, I greatly appreciate that! :3
I think in our case the format width parameter should be treated as padding. So in the above case you gave we should add spaces to the result on the left. There are other flags like
In terms of formatting, I believe we should only support positive values for precision format parameters. I know the library itself supports negative places/precision, but for formatting, I don't think it's something necessary. If there will be a community need for that feature, we could add this later. :D |
It would be nice if
Decimal
types implemented thefmt.Formatter
interface to allow the use of standardfmt
verbs/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
The text was updated successfully, but these errors were encountered: