StringFixedBank returns a banker rounded fixed-point string with places digits after the decimal point. Example: NewFromFloat(0).StringFixedBank(2) // output: "0.00" NewFromFloat(0).StringFixedBank(0) // output: "0" NewFromFloat(5.45).StringFixedBank(0) // output: "5" NewFromFloat(5.45).String
(places int32)
| 1502 | // NewFromFloat(5.45).StringFixedBank(3) // output: "5.450" |
| 1503 | // NewFromFloat(545).StringFixedBank(-1) // output: "540" |
| 1504 | func (d Decimal) StringFixedBank(places int32) string { |
| 1505 | rounded := d.RoundBank(places) |
| 1506 | return rounded.string(false) |
| 1507 | } |
| 1508 | |
| 1509 | // StringFixedCash returns a Swedish/Cash rounded fixed-point string. For |
| 1510 | // more details see the documentation at function RoundCash. |