You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
humanize.Commaf(float64(1.1234567890), 2)
strconv.FormatFloat has a precision, just add and int like:
since you can not overload you could copy the func and rename it Commafp
that way it does not break.
Also noted that this is not localized; not that hard to localize the comma and period.
humanize.Commaf(float64(1.1234567890), 2)
strconv.FormatFloat has a precision, just add and int like:
since you can not overload you could copy the func and rename it Commafp
that way it does not break.
Also noted that this is not localized; not that hard to localize the comma and period.
func Commafp(v float64, prec int) string {
...
parts := strings.Split(strconv.FormatFloat(v, 'f', prec, 64), ".")
Update: This does the same thing: CommafWithDigits
The text was updated successfully, but these errors were encountered: