summaryrefslogtreecommitdiff
path: root/vendor/github.com/tdewolff/parse/v2/strconv/price.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2023-10-30 11:06:51 +0100
committerLibravatar GitHub <noreply@github.com>2023-10-30 11:06:51 +0100
commit32e70ec83dbd142fb44d7d8f4c3d6007ab4cf73b (patch)
treeb896fe1974ecc8fefe9b2838bedf2668eac40eed /vendor/github.com/tdewolff/parse/v2/strconv/price.go
parent[docs] added split-domain configuration for Caddy 2 (#2288) (diff)
downloadgotosocial-32e70ec83dbd142fb44d7d8f4c3d6007ab4cf73b.tar.xz
[chore]: Bump github.com/tdewolff/minify/v2 from 2.19.10 to 2.20.0 (#2316)
Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.19.10 to 2.20.0. - [Release notes](https://github.com/tdewolff/minify/releases) - [Commits](https://github.com/tdewolff/minify/compare/v2.19.10...v2.20.0) --- updated-dependencies: - dependency-name: github.com/tdewolff/minify/v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/tdewolff/parse/v2/strconv/price.go')
-rw-r--r--vendor/github.com/tdewolff/parse/v2/strconv/price.go83
1 files changed, 0 insertions, 83 deletions
diff --git a/vendor/github.com/tdewolff/parse/v2/strconv/price.go b/vendor/github.com/tdewolff/parse/v2/strconv/price.go
deleted file mode 100644
index 18ded69f5..000000000
--- a/vendor/github.com/tdewolff/parse/v2/strconv/price.go
+++ /dev/null
@@ -1,83 +0,0 @@
-package strconv
-
-// AppendPrice will append an int64 formatted as a price, where the int64 is the price in cents.
-// It does not display whether a price is negative or not.
-func AppendPrice(b []byte, price int64, dec bool, milSeparator byte, decSeparator byte) []byte {
- if price < 0 {
- if price == -9223372036854775808 {
- x := []byte("92 233 720 368 547 758 08")
- x[2] = milSeparator
- x[6] = milSeparator
- x[10] = milSeparator
- x[14] = milSeparator
- x[18] = milSeparator
- x[22] = decSeparator
- return append(b, x...)
- }
- price = -price
- }
-
- // rounding
- if !dec {
- firstDec := (price / 10) % 10
- if 5 <= firstDec {
- price += 100
- }
- }
-
- // calculate size
- n := LenInt(price) - 2
- if 0 < n {
- n += (n - 1) / 3 // mil separator
- } else {
- n = 1
- }
- if dec {
- n += 2 + 1 // decimals + dec separator
- }
-
- // resize byte slice
- i := len(b)
- if cap(b) < i+n {
- b = append(b, make([]byte, n)...)
- } else {
- b = b[:i+n]
- }
-
- // print fractional-part
- i += n - 1
- if dec {
- for j := 0; j < 2; j++ {
- c := byte(price%10) + '0'
- price /= 10
- b[i] = c
- i--
- }
- b[i] = decSeparator
- i--
- } else {
- price /= 100
- }
-
- if price == 0 {
- b[i] = '0'
- return b
- }
-
- // print integer-part
- j := 0
- for 0 < price {
- if j == 3 {
- b[i] = milSeparator
- i--
- j = 0
- }
-
- c := byte(price%10) + '0'
- price /= 10
- b[i] = c
- i--
- j++
- }
- return b
-}