{"id":13412828,"url":"https://github.com/leekchan/accounting","last_synced_at":"2026-02-07T03:32:36.158Z","repository":{"id":36179613,"uuid":"40483745","full_name":"leekchan/accounting","owner":"leekchan","description":"money and currency formatting for golang","archived":false,"fork":false,"pushed_at":"2022-07-28T18:11:49.000Z","size":108,"stargazers_count":872,"open_issues_count":13,"forks_count":73,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-07-31T20:51:29.301Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leekchan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-10T13:23:56.000Z","updated_at":"2024-07-19T19:27:36.000Z","dependencies_parsed_at":"2022-07-18T08:31:01.471Z","dependency_job_id":null,"html_url":"https://github.com/leekchan/accounting","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/leekchan/accounting","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leekchan%2Faccounting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leekchan%2Faccounting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leekchan%2Faccounting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leekchan%2Faccounting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leekchan","download_url":"https://codeload.github.com/leekchan/accounting/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leekchan%2Faccounting/sbom","scorecard":{"id":582705,"data":{"date":"2025-08-11","repo":{"name":"github.com/leekchan/accounting","commit":"2e09117338f81558182056c197506abceadc83e0"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.7,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":5,"reason":"Found 9/18 approved changesets -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 21 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T19:36:21.844Z","repository_id":36179613,"created_at":"2025-08-20T19:36:21.844Z","updated_at":"2025-08-20T19:36:21.844Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29185344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T00:44:15.062Z","status":"online","status_checked_at":"2026-02-07T02:00:07.217Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T20:01:29.751Z","updated_at":"2026-02-07T03:32:36.139Z","avatar_url":"https://github.com/leekchan.png","language":"Go","funding_links":[],"categories":["Go","开源类库","Financial","\u003cspan id=\"金融-financial\"\u003e金融 Financial\u003c/span\u003e","金融","財經","金融领域相关库","金融领域相关库`处理货币与金融领域的库`","Relational Databases","Money, Currency \u0026 Formatting","Libraries","财经"],"sub_categories":["数学计算","Search and Analytic Databases","Advanced Console UIs","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","高級控制台界面","SQL 查询语句构建库","检索及分析资料库","Go","高级控制台界面"],"readme":"# accounting - money and currency formatting for golang\n[![Build Status](https://travis-ci.org/leekchan/accounting.svg?branch=master)](https://travis-ci.org/leekchan/accounting)\n[![Coverage Status](https://coveralls.io/repos/leekchan/accounting/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/leekchan/accounting?branch=master)\n[![GoDoc](https://godoc.org/github.com/leekchan/accounting?status.svg)](https://godoc.org/github.com/leekchan/accounting)\n\naccounting is a library for money and currency formatting. (inspired by [accounting.js](https://github.com/openexchangerates/accounting.js))\n\n\n## Quick Start\n\n```\ngo get github.com/leekchan/accounting\n```\n\nexample.go\n\n```Go\npackage main\n\nimport (\n    \"fmt\"\n    \"math/big\"\n\n    \"github.com/shopspring/decimal\"\n    \"github.com/leekchan/accounting\"\n)\n\nfunc main() {\n    ac := accounting.Accounting{Symbol: \"$\", Precision: 2}\n    fmt.Println(ac.FormatMoney(123456789.213123))                       // \"$123,456,789.21\"\n    fmt.Println(ac.FormatMoney(12345678))                               // \"$12,345,678.00\"\n    fmt.Println(ac.FormatMoney(big.NewRat(77777777, 3)))                // \"$25,925,925.67\"\n    fmt.Println(ac.FormatMoney(big.NewRat(-77777777, 3)))               // \"-$25,925,925.67\"\n    fmt.Println(ac.FormatMoneyBigFloat(big.NewFloat(123456789.213123))) // \"$123,456,789.21\"\n    fmt.Println(ac.FormatMoneyDecimal(decimal.New(123456789.213123, 0))) // \"$123,456,789.21\"\n\n    ac = accounting.Accounting{Symbol: \"€\", Precision: 2, Thousand: \".\", Decimal: \",\"}\n    fmt.Println(ac.FormatMoney(4999.99))  // \"€4.999,99\"\n\n    // Or retrieve currency info from Locale struct\n    lc := LocaleInfo[\"USD\"]\n    ac = accounting.Accounting{Symbol: lc.ComSymbol, Precision: 2, Thousand: lc.ThouSep, Decimal: lc.DecSep}\n    fmt.Println(ac.FormatMoney(500000)) // \"$500,000.00\"\n\n    ac = accounting.Accounting{Symbol: \"£ \", Precision: 0}\n    fmt.Println(ac.FormatMoney(500000)) // \"£ 500,000\"\n\n    ac = accounting.Accounting{Symbol: \"GBP\", Precision: 0,\n        Format: \"%s %v\", FormatNegative: \"%s (%v)\", FormatZero: \"%s --\"}\n    fmt.Println(ac.FormatMoney(1000000)) // \"GBP 1,000,000\"\n    fmt.Println(ac.FormatMoney(-5000))   // \"GBP (5,000)\"\n    fmt.Println(ac.FormatMoney(0))       // \"GBP --\"\n\n    ac = accounting.DefaultAccounting(\"GBP\", 2)\n    fmt.Println(ac.FormatMoney(1000000)) // \"GBP 1,000,000\"\n    fmt.Println(ac.FormatMoney(-5000))   // \"GBP (5,000)\"\n    fmt.Println(ac.FormatMoney(0))       // \"GBP --\"\n\n    ac = accounting.NewAccounting(\"GBP\", 2, \",\", \".\", \"%s %v\", \"%s (%v)\", \"%s --\")\n    fmt.Println(ac.FormatMoney(1000000)) // \"GBP 1,000,000\"\n    fmt.Println(ac.FormatMoney(-5000))   // \"GBP (5,000)\"\n    fmt.Println(ac.FormatMoney(0))       // \"GBP --\"\n}\n```\n\n## Caution\n\nPlease do not use float64 to count money. Floats can have errors when you perform operations on them. Using [big.Rat](https://golang.org/pkg/math/big/#Rat) (\u003c Go 1.5) or [big.Float](https://golang.org/pkg/math/big/#Float) (\u003e= Go 1.5) is highly recommended.\n(accounting supports float64, but it is just for convenience.)\n\n* [FormatMoneyBigFloat(value *big.Float) string](#formatmoneybigfloatvalue-bigfloat-string)\n* [FormatMoneyBigRat(value *big.Rat) string](#formatmoneybigratvalue-bigrat-string)\n\n## Initialization\n\n### Accounting struct\n\n```Go\ntype Accounting struct {\n    Symbol         string // currency symbol (required)\n    Precision      int    // currency precision (decimal places) (optional / default: 0)\n    Thousand       string // thousand separator (optional / default: ,)\n    Decimal        string // decimal separator (optional / default: .)\n    Format         string // simple format string allows control of symbol position (%v = value, %s = symbol) (default: %s%v)\n    FormatNegative string // format string for negative values (optional / default: strings.Replace(strings.Replace(accounting.Format, \"-\", \"\", -1), \"%v\", \"-%v\", -1))\n    FormatZero     string // format string for zero values (optional / default: Format)\n}\n```\n\nField | Type | Description | Default | Example\n-------------| ------------- | ------------- | ------------- | -------------\nSymbol         | string | currency symbol | no default value | $\nPrecision      | int    | currency precision (decimal places) | 0 | 2\nThousand       | string | thousand separator | , | .\nDecimal        | string | decimal separator | . | ,\nFormat         | string | simple format string allows control of symbol position (%v = value, %s = symbol) | %s%v | %s %v\nFormatNegative | string | format string for negative values | strings.Replace(strings.Replace(accounting.Format, \"-\", \"\", -1), \"%v\", \"-%v\", -1)) | %s (%v)\nFormatZero     | string | format string for zero values | Format | %s --\n\n**Examples:**\n\n```Go\n# Via functions\nac := accounting.DefaultAccounting(\"$\", 2)\nac := accounting.NewAccounting(\"$\", 2, \",\", \".\", \"%s %v\", \"%s (%v)\", \"%s --\")\n\n# Via Accounting struct\nac := accounting.Accounting{Symbol: \"$\", Precision: 2}\n\nac = accounting.Accounting{Symbol: \"€\", Precision: 2, Thousand: \".\", Decimal: \",\"}\n\nac = accounting.Accounting{Symbol: \"GBP\", Precision: 0,\n        Format: \"%s %v\", FormatNegative: \"%s (%v)\", FormatZero: \"%s --\"}\n```\n\n## SetThousandSeparator(str string)\n\nSetThousandSeparator sets the separator for the thousands separation\n\n## SetDecimalSeparator(str string)\n\nSetDecimalSeparator sets the separator for the decimal separation\n\n## SetFormat(str string)\n\nSetFormat sets the Format default: `%s%v` (%s=Symbol;%v=Value)\n\n## SetFormatNegative(str string)\n\nSetFormatNegative sets the Format for negative values default: `-%s%v` (%s=Symbol;%v=Value)\n\n## SetFormatZero(str string)\n\nSetFormatZero sets the Format for zero values default: `%s%v` (%s=Symbol;%v=Value)\n\n### Locale struct\n\n```Go\ntype Locale struct {\n    Name           string // currency name\n    FractionLength int    // default decimal length\n    ThouSep        string // thousands seperator\n    DecSep         string // decimal seperator\n    SpaceSep       string // space seperator\n    UTFSymbol      string // UTF symbol\n    HTMLSymbol     string // HTML symbol\n    ComSymbol      string // Common symbol\n    Pre            bool   // symbol before or after currency\n}\n```\n\nField | Type | Description | Default | Example\n -------------| ------------- | ------------- | ------------- | -------------\n Name           | string | currency name | no default value | US Dollar \n FractionLength | int    | default precision (decimal places) | no default value | 2\n ThouSep        | string | thousand separator | no default value | ,\n DecSep         | string | decimal separator | no default value | .\n SpaceSep       | string | space separator | no default value | \" \"\n UTFSymbol      | string | UTF symbol | no default value | \"0024\" \n HTMLSymbol     | string | HTML symbol | no default value | \"\u0026#x0024\"\n ComSymbol      | string | Common symbol | no default value | \"$\"\n Pre            | bool   | symbol before currency | no default value | true\n\n**Example:**\n\n```Go\n// LocaleInfo map[string]Locale\n\nvar lc Locale\nif val, ok := LocaleInfo[\"USD\"]; ok {\n    lc = val\n} else {\n    panic(\"No Locale Info Found\")\n}\n\nfmt.Println(lc.Name) // \"US Dollar\"\nfmt.Println(lc.FractionLength) // 2\nfmt.Println(lc.ThouSep) // \",\"\nfmt.Println(lc.DecSep) // \".\"\nfmt.Println(lc.SpaceSep) // \"\"\nfmt.Println(lc.UTFSymbol) // \"0024\"\nfmt.Println(lc.HTMLSymbol) // \"\u0026#x0024\"\nfmt.Println(lc.ComSymbol) // \"$\"\nfmt.Println(lc.Pre) // true\n```\nThere are currently 181 currencies supported in LocaleInfo\n\n## FormatMoney(value interface{}) string\n\nFormatMoney is a function for formatting numbers as money values, with customisable currency symbol, precision (decimal places), and thousand/decimal separators.\n\nFormatMoney supports various types of value by runtime reflection. If you don't need runtime type evaluation, please refer to FormatMoneyInt, FormatMoneyBigRat, FormatMoneyBigRat, or FormatMoneyFloat64.\n\n* supported value types : int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, float32, float64, *big.Rat\n\n**Examples:**\n\n```Go\nac := accounting.Accounting{Symbol: \"$\", Precision: 2}\nfmt.Println(ac.FormatMoney(123456789.213123))         // \"$123,456,789.21\"\nfmt.Println(ac.FormatMoney(12345678))                 // \"$12,345,678.00\"\nfmt.Println(ac.FormatMoney(big.NewRat(77777777, 3)))  // \"$25,925,925.67\"\nfmt.Println(ac.FormatMoney(big.NewRat(-77777777, 3))) // \"-$25,925,925.67\"\n\nac = accounting.Accounting{Symbol: \"€\", Precision: 2, Thousand: \".\", Decimal: \",\"}\nfmt.Println(ac.FormatMoney(4999.99))  // \"€4.999,99\"\n\nac = accounting.Accounting{Symbol: \"£ \", Precision: 0}\nfmt.Println(ac.FormatMoney(500000)) // \"£ 500,000\"\n\nac = accounting.Accounting{Symbol: \"GBP\", Precision: 0,\n    Format: \"%s %v\", FormatNegative: \"%s (%v)\", FormatZero: \"%s --\"}\nfmt.Println(ac.FormatMoney(1000000)) // \"GBP 1,000,000\"\nfmt.Println(ac.FormatMoney(-5000))   // \"GBP (5,000)\"\nfmt.Println(ac.FormatMoney(0))       // \"GBP --\"\n```\n\n## FormatMoneyBigFloat(value *big.Float) string\n\n**(\u003e= Go 1.5)**\n\nFormatMoneyBigFloat only supports [*big.Float](https://golang.org/pkg/math/big/#Float) value. It is faster than FormatMoney, because it does not do any runtime type evaluation.\n\n**Examples:**\n\n```Go\nac = accounting.Accounting{Symbol: \"$\", Precision: 2}\nfmt.Println(ac.FormatMoneyBigFloat(big.NewFloat(123456789.213123))) // \"$123,456,789.21\"\nfmt.Println(ac.FormatMoneyBigFloat(big.NewFloat(12345678)))         // \"$12,345,678.00\"\n\nac = accounting.Accounting{Symbol: \"€\", Precision: 2, Thousand: \".\", Decimal: \",\"}\nfmt.Println(ac.FormatMoneyBigFloat(big.NewFloat(4999.99)))  // \"€4.999,99\"\n\nac = accounting.Accounting{Symbol: \"£ \", Precision: 0}\nfmt.Println(ac.FormatMoneyBigFloat(big.NewFloat(500000))) // \"£ 500,000\"\n\nac = accounting.Accounting{Symbol: \"GBP\", Precision: 0,\n    Format: \"%s %v\", FormatNegative: \"%s (%v)\", FormatZero: \"%s --\"}\nfmt.Println(ac.FormatMoneyBigFloat(big.NewFloat(1000000))) // \"GBP 1,000,000\"\nfmt.Println(ac.FormatMoneyBigFloat(big.NewFloat(-5000)))   // \"GBP (5,000)\"\nfmt.Println(ac.FormatMoneyBigFloat(big.NewFloat(0)))       // \"GBP --\"\n```\n\n## FormatMoneyInt(value int) string\n\nFormatMoneyInt only supports int value. It is faster than FormatMoney, because it does not do any runtime type evaluation.\n\n**Examples:**\n\n```Go\nac = accounting.Accounting{Symbol: \"$\", Precision: 2}\nfmt.Println(ac.FormatMoneyInt(12345678)) // \"$12,345,678.00\"\n\nac = accounting.Accounting{Symbol: \"€\", Precision: 2, Thousand: \".\", Decimal: \",\"}\nfmt.Println(ac.FormatMoneyInt(4999))  // \"€4.999,00\"\n\nac = accounting.Accounting{Symbol: \"£ \", Precision: 0}\nfmt.Println(ac.FormatMoneyInt(500000)) // \"£ 500,000\"\n\nac = accounting.Accounting{Symbol: \"GBP\", Precision: 0,\n    Format: \"%s %v\", FormatNegative: \"%s (%v)\", FormatZero: \"%s --\"}\nfmt.Println(ac.FormatMoneyInt(1000000)) // \"GBP 1,000,000\"\nfmt.Println(ac.FormatMoneyInt(-5000))   // \"GBP (5,000)\"\nfmt.Println(ac.FormatMoneyInt(0))       // \"GBP --\"\n```\n\n## FormatMoneyBigRat(value *big.Rat) string\n\nFormatMoneyBigRat only supports [*big.Rat](https://golang.org/pkg/math/big/#Rat) value. It is faster than FormatMoney, because it does not do any runtime type evaluation.\n\n**Examples:**\n\n```Go\nac = accounting.Accounting{Symbol: \"$\", Precision: 2}\nfmt.Println(ac.FormatMoneyBigRat(big.NewRat(77777777, 3)))  // \"$25,925,925.67\"\nfmt.Println(ac.FormatMoneyBigRat(big.NewRat(-77777777, 3))) // \"-$25,925,925.67\"\n\nac = accounting.Accounting{Symbol: \"€\", Precision: 2, Thousand: \".\", Decimal: \",\"}\nfmt.Println(ac.FormatMoneyBigRat(big.NewRat(77777777, 3)))  // \"€25.925.925,67\"\n\nac = accounting.Accounting{Symbol: \"£ \", Precision: 0}\nfmt.Println(ac.FormatMoneyBigRat(big.NewRat(77777777, 3)))  // \"£ 25,925,926\"\n\nac = accounting.Accounting{Symbol: \"GBP\", Precision: 0,\n    Format: \"%s %v\", FormatNegative: \"%s (%v)\", FormatZero: \"%s --\"}\nfmt.Println(ac.FormatMoneyBigRat(big.NewRat(77777777, 3)))  // \"GBP 25,925,926\"\nfmt.Println(ac.FormatMoneyBigRat(big.NewRat(-77777777, 3))) // \"GBP (25,925,926)\"\nfmt.Println(ac.FormatMoneyBigRat(big.NewRat(0, 3)))         // \"GBP --\"\n```\n\n## FormatMoneyFloat64(value float64) string\n\nFormatMoneyFloat64 only supports float64 value. It is faster than FormatMoney, because it does not do any runtime type evaluation.\n\n**Examples:**\n\n```Go\nac = accounting.Accounting{Symbol: \"$\", Precision: 2}\nfmt.Println(ac.FormatMoneyFloat64(123456789.213123)) // \"$123,456,789.21\"\nfmt.Println(ac.FormatMoneyFloat64(12345678))         // \"$12,345,678.00\"\n\nac = accounting.Accounting{Symbol: \"€\", Precision: 2, Thousand: \".\", Decimal: \",\"}\nfmt.Println(ac.FormatMoneyFloat64(4999.99))  // \"€4.999,99\"\n\nac = accounting.Accounting{Symbol: \"£ \", Precision: 0}\nfmt.Println(ac.FormatMoneyFloat64(500000)) // \"£ 500,000\"\n\nac = accounting.Accounting{Symbol: \"GBP\", Precision: 0,\n    Format: \"%s %v\", FormatNegative: \"%s (%v)\", FormatZero: \"%s --\"}\nfmt.Println(ac.FormatMoneyFloat64(1000000)) // \"GBP 1,000,000\"\nfmt.Println(ac.FormatMoneyFloat64(-5000))   // \"GBP (5,000)\"\nfmt.Println(ac.FormatMoneyFloat64(0))       // \"GBP --\"\n```\n\n## FormatNumber(value interface{}, precision int, thousand string, decimal string) string\n\nFormatNumber is a base function of the library which formats a number with custom precision and separators. \n\nFormatNumber supports various types of value by runtime reflection. If you don't need runtime type evaluation, please refer to FormatNumberInt, FormatNumberBigRat, or FormatNumberFloat64.\n\n* supported value types : int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, float32, float64, *big.Rat\n\n**Examples:**\n\n```Go\nfmt.Println(accounting.FormatNumber(123456789.213123, 3, \",\", \".\")) // \"123,456,789.213\"\nfmt.Println(accounting.FormatNumber(1000000, 3, \" \", \",\"))          // \"1 000 000,000\"\n```\n\n## FormatNumberBigFloat(value *big.Float, precision int, thousand string, decimal string) string\n\n**(\u003e= Go 1.5)**\n\nFormatNumberBigFloat only supports [*big.Float](https://golang.org/pkg/math/big/#Float) value. It is faster than FormatNumber, because it does not do any runtime type evaluation.\n\n**Examples:**\n\n```Go\nfmt.Println(accounting.FormatNumberBigFloat(big.NewFloat(123456789.213123), 3, \",\", \".\")) // \"123,456,789.213\"\n```\n\n## FormatNumberInt(value int, precision int, thousand string, decimal string) string\n\nFormatNumberInt only supports int value. It is faster than FormatNumber, because it does not do any runtime type evaluation.\n\n**Examples:**\n\n```Go\nfmt.Println(accounting.FormatNumberInt(123456789, 3, \",\", \".\")) // \"123,456,789.000\"\n```\n\n## FormatNumberBigRat(value *big.Rat, precision int, thousand string, decimal string) string\n\nFormatNumberBigRat only supports [*big.Rat](https://golang.org/pkg/math/big/#Rat) value. It is faster than FormatNumber, because it does not do any runtime type evaluation.\n\n**Examples:**\n\n```Go\nfmt.Println(accounting.FormatNumberBigRat(big.NewRat(77777777, 3), 3, \",\", \".\")) // \"25,925,925.667\"\n```\n\n## FormatNumberFloat64(value float64, precision int, thousand string, decimal string) string\n\nFormatNumberFloat64 only supports float64 value. It is faster than FormatNumber, because it does not do any runtime type evaluation.\n\n**Examples:**\n\n```Go\nfmt.Println(accounting.FormatNumberFloat64(123456789.213123, 3, \",\", \".\")) // \"123,456,789.213\"\n```\n\n## FormatNumberDecimal(value decimal.Decimal, precision int, thousand string, decimal string) string\n\nFormatNumberDecimal only supports [decimal.Decimal](https://github.com/shopspring/decimal) value. It is faster than FormatNumber, because it does not do any runtime type evaluation.\n\n**Examples:**\n\n```Go\nimport \"github.com/shopspring/decimal\"\nfmt.Println(accounting.FormatNumberBigDecimal(apd.New(apd.New(4999999, -3), 3, \",\", \".\")) // \"4,999.999\"\n```\n\n## FormatNumberBigDecimal(value apd.Decimal, precision int, thousand string, decimal string) string\n\nFormatNumberDecimal only supports [apd.Decimal](https://github.com/cockroachdb/apd) value. It is faster than FormatNumber, because it does not do any runtime type evaluation.\n\n**Examples:**\n\n```Go\nimport \"github.com/cockroachdb/apd\"\nfmt.Println(accounting.FormatNumberDecimal(decimal.New(123456789.213123,3), 3, \",\", \".\")) // \"123,456,789.213\"\n```\n\n## UnformatNumber(number string, precision int, currency string) string\n\nUnformatNumber is the inverse of FormatNumber. It strips out all currency formatting and returns the number with a point for the decimal seperator. \n\n**Examples:**\n\n```Go\nfmt.Println(accounting.UnformatNumber(\"$45,000.50\", 2, \"USD\")) // \"45000.50\"\nfmt.Println(accounting.UnformatNumber(\"EUR 12.500,3474\", 3, \"EUR\")) // \"12500.347\"\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleekchan%2Faccounting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleekchan%2Faccounting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleekchan%2Faccounting/lists"}