decimal
decimal copied to clipboard
String with thousands separator
How to get string with thousands separator? e.g 4,294,967.45 for 4294967.45
Hi again!
- If you meant decimal string representation, currently it is not possible as
decimal.String()
is not parametrized. You would have to implement it by yourself. - If you meant parsing string representation of decimal with thousands separator there is a init method called
decimal.NewFromFormattedString
. It can be used for parsing differently formatted inputs using regular expressions.
Example:
r2 := regexp.MustCompile("[_]")
d2, err := NewFromFormattedString("1_000_000", r2)