Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/locales.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/vo_001
diff options
context:
space:
mode:
authorjoeybloggs <Dean.Karn@gmail.com>2016-08-16 04:59:49 +0300
committerjoeybloggs <Dean.Karn@gmail.com>2016-08-16 04:59:49 +0300
commitaaa28727a7fc0cc7add5d60b31abfe62b983bedd (patch)
tree032798ba24e7ab36f7532d5ae66df80805029538 /vo_001
parent5e30685010ab9c6da8cc729a3e7eab0b1ae964ae (diff)
add accounting currency formatting logic + function
Diffstat (limited to 'vo_001')
-rw-r--r--vo_001/vo_001.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/vo_001/vo_001.go b/vo_001/vo_001.go
index d805bb5c..a26ff9d2 100644
--- a/vo_001/vo_001.go
+++ b/vo_001/vo_001.go
@@ -103,5 +103,15 @@ func (vo *vo_001) FmtCurrency(num float64, v uint64, currency currency.Type) []b
s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
symbol := vo.currencies[currency]
- return []byte(s)
+ return append(append([]byte{}, symbol...), s...)
+}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'vo_001'
+// in accounting notation. returned as a []byte just in case the caller wishes to add more and can help
+// avoid allocations; otherwise just cast as string.
+func (vo *vo_001) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := vo.currencies[currency]
+ return append(append([]byte{}, symbol...), s...)
}