StringFixed returns a rounded fixed-point string with places digits after the decimal point. Example: NewFromFloat(0).StringFixed(2) // output: "0.00" NewFromFloat(0).StringFixed(0) // output: "0" NewFromFloat(5.45).StringFixed(0) // output: "5" NewFromFloat(5.45).StringFixed(1) // output: "5.
(places int32)
| 1485 | // NewFromFloat(5.45).StringFixed(3) // output: "5.450" |
| 1486 | // NewFromFloat(545).StringFixed(-1) // output: "550" |
| 1487 | func (d Decimal) StringFixed(places int32) string { |
| 1488 | rounded := d.Round(places) |
| 1489 | return rounded.string(false) |
| 1490 | } |
| 1491 | |
| 1492 | // StringFixedBank returns a banker rounded fixed-point string with places digits |
| 1493 | // after the decimal point. |