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
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
parent5e30685010ab9c6da8cc729a3e7eab0b1ae964ae (diff)
add accounting currency formatting logic + function
-rw-r--r--af/af.go79
-rw-r--r--af_NA/af_NA.go79
-rw-r--r--af_ZA/af_ZA.go79
-rw-r--r--agq/agq.go73
-rw-r--r--agq_CM/agq_CM.go73
-rw-r--r--ak/ak.go70
-rw-r--r--ak_GH/ak_GH.go70
-rw-r--r--am/am.go76
-rw-r--r--am_ET/am_ET.go76
-rw-r--r--ar/ar.go84
-rw-r--r--ar_001/ar_001.go84
-rw-r--r--ar_AE/ar_AE.go84
-rw-r--r--ar_BH/ar_BH.go84
-rw-r--r--ar_DJ/ar_DJ.go84
-rw-r--r--ar_DZ/ar_DZ.go78
-rw-r--r--ar_EG/ar_EG.go84
-rw-r--r--ar_EH/ar_EH.go84
-rw-r--r--ar_ER/ar_ER.go84
-rw-r--r--ar_IL/ar_IL.go84
-rw-r--r--ar_IQ/ar_IQ.go84
-rw-r--r--ar_JO/ar_JO.go84
-rw-r--r--ar_KM/ar_KM.go84
-rw-r--r--ar_KW/ar_KW.go84
-rw-r--r--ar_LB/ar_LB.go78
-rw-r--r--ar_LY/ar_LY.go78
-rw-r--r--ar_MA/ar_MA.go78
-rw-r--r--ar_MR/ar_MR.go78
-rw-r--r--ar_OM/ar_OM.go84
-rw-r--r--ar_PS/ar_PS.go84
-rw-r--r--ar_QA/ar_QA.go84
-rw-r--r--ar_SA/ar_SA.go84
-rw-r--r--ar_SD/ar_SD.go84
-rw-r--r--ar_SO/ar_SO.go84
-rw-r--r--ar_SS/ar_SS.go84
-rw-r--r--ar_SY/ar_SY.go84
-rw-r--r--ar_TD/ar_TD.go84
-rw-r--r--ar_TN/ar_TN.go78
-rw-r--r--ar_YE/ar_YE.go84
-rw-r--r--as/as.go93
-rw-r--r--as_IN/as_IN.go93
-rw-r--r--asa/asa.go80
-rw-r--r--asa_TZ/asa_TZ.go80
-rw-r--r--ast/ast.go80
-rw-r--r--ast_ES/ast_ES.go80
-rw-r--r--az/az.go78
-rw-r--r--az_Cyrl/az_Cyrl.go78
-rw-r--r--az_Cyrl_AZ/az_Cyrl_AZ.go76
-rw-r--r--az_Latn/az_Latn.go78
-rw-r--r--az_Latn_AZ/az_Latn_AZ.go78
-rw-r--r--bas/bas.go77
-rw-r--r--bas_CM/bas_CM.go77
-rw-r--r--be/be.go79
-rw-r--r--be_BY/be_BY.go81
-rw-r--r--bem/bem.go82
-rw-r--r--bem_ZM/bem_ZM.go82
-rw-r--r--bez/bez.go76
-rw-r--r--bez_TZ/bez_TZ.go76
-rw-r--r--bg/bg.go77
-rw-r--r--bg_BG/bg_BG.go77
-rw-r--r--bm/bm.go82
-rw-r--r--bm_ML/bm_ML.go82
-rw-r--r--bn/bn.go87
-rw-r--r--bn_BD/bn_BD.go87
-rw-r--r--bn_IN/bn_IN.go87
-rw-r--r--bo/bo.go78
-rw-r--r--bo_CN/bo_CN.go78
-rw-r--r--bo_IN/bo_IN.go78
-rw-r--r--br/br.go80
-rw-r--r--br_FR/br_FR.go80
-rw-r--r--brx/brx.go85
-rw-r--r--brx_IN/brx_IN.go85
-rw-r--r--bs/bs.go72
-rw-r--r--bs_Cyrl/bs_Cyrl.go72
-rw-r--r--bs_Cyrl_BA/bs_Cyrl_BA.go72
-rw-r--r--bs_Latn/bs_Latn.go72
-rw-r--r--bs_Latn_BA/bs_Latn_BA.go74
-rw-r--r--ca/ca.go74
-rw-r--r--ca_AD/ca_AD.go74
-rw-r--r--ca_ES/ca_ES.go74
-rw-r--r--ca_ES_VALENCIA/ca_ES_VALENCIA.go74
-rw-r--r--ca_FR/ca_FR.go74
-rw-r--r--ca_IT/ca_IT.go74
-rw-r--r--ce/ce.go72
-rw-r--r--ce_RU/ce_RU.go72
-rw-r--r--cgg/cgg.go76
-rw-r--r--cgg_UG/cgg_UG.go76
-rw-r--r--chr/chr.go76
-rw-r--r--chr_US/chr_US.go76
-rw-r--r--ckb/ckb.go14
-rw-r--r--ckb_IQ/ckb_IQ.go12
-rw-r--r--ckb_IR/ckb_IR.go12
-rw-r--r--cmd/generate_resources.go8
-rw-r--r--cmd/translator.tmpl197
-rw-r--r--cs/cs.go80
-rw-r--r--cs_CZ/cs_CZ.go80
-rw-r--r--cu/cu.go75
-rw-r--r--cu_RU/cu_RU.go75
-rw-r--r--cy/cy.go82
-rw-r--r--cy_GB/cy_GB.go82
-rw-r--r--da/da.go72
-rw-r--r--da_DK/da_DK.go72
-rw-r--r--da_GL/da_GL.go72
-rw-r--r--dav/dav.go82
-rw-r--r--dav_KE/dav_KE.go82
-rw-r--r--de/de.go72
-rw-r--r--de_AT/de_AT.go79
-rw-r--r--de_BE/de_BE.go72
-rw-r--r--de_CH/de_CH.go76
-rw-r--r--de_DE/de_DE.go72
-rw-r--r--de_LI/de_LI.go76
-rw-r--r--de_LU/de_LU.go72
-rw-r--r--dje/dje.go73
-rw-r--r--dje_NE/dje_NE.go73
-rw-r--r--dsb/dsb.go72
-rw-r--r--dsb_DE/dsb_DE.go72
-rw-r--r--dua/dua.go77
-rw-r--r--dua_CM/dua_CM.go77
-rw-r--r--dyo/dyo.go77
-rw-r--r--dyo_SN/dyo_SN.go77
-rw-r--r--dz/dz.go77
-rw-r--r--dz_BT/dz_BT.go77
-rw-r--r--ebu/ebu.go82
-rw-r--r--ebu_KE/ebu_KE.go82
-rw-r--r--ee/ee.go82
-rw-r--r--ee_GH/ee_GH.go82
-rw-r--r--ee_TG/ee_TG.go82
-rw-r--r--el/el.go74
-rw-r--r--el_CY/el_CY.go74
-rw-r--r--el_GR/el_GR.go74
-rw-r--r--en/en.go78
-rw-r--r--en/en_test.go39
-rw-r--r--en_001/en_001.go78
-rw-r--r--en_150/en_150.go74
-rw-r--r--en_AG/en_AG.go76
-rw-r--r--en_AI/en_AI.go78
-rw-r--r--en_AS/en_AS.go76
-rw-r--r--en_AT/en_AT.go76
-rw-r--r--en_AU/en_AU.go76
-rw-r--r--en_BB/en_BB.go76
-rw-r--r--en_BE/en_BE.go72
-rw-r--r--en_BI/en_BI.go76
-rw-r--r--en_BM/en_BM.go76
-rw-r--r--en_BS/en_BS.go76
-rw-r--r--en_BW/en_BW.go76
-rw-r--r--en_BZ/en_BZ.go76
-rw-r--r--en_CA/en_CA.go76
-rw-r--r--en_CC/en_CC.go78
-rw-r--r--en_CH/en_CH.go74
-rw-r--r--en_CK/en_CK.go76
-rw-r--r--en_CM/en_CM.go76
-rw-r--r--en_CX/en_CX.go76
-rw-r--r--en_CY/en_CY.go78
-rw-r--r--en_DE/en_DE.go76
-rw-r--r--en_DG/en_DG.go76
-rw-r--r--en_DK/en_DK.go76
-rw-r--r--en_DM/en_DM.go76
-rw-r--r--en_ER/en_ER.go78
-rw-r--r--en_FI/en_FI.go79
-rw-r--r--en_FJ/en_FJ.go76
-rw-r--r--en_FK/en_FK.go76
-rw-r--r--en_FM/en_FM.go76
-rw-r--r--en_GB/en_GB.go76
-rw-r--r--en_GD/en_GD.go76
-rw-r--r--en_GG/en_GG.go76
-rw-r--r--en_GH/en_GH.go76
-rw-r--r--en_GI/en_GI.go76
-rw-r--r--en_GM/en_GM.go76
-rw-r--r--en_GU/en_GU.go78
-rw-r--r--en_GY/en_GY.go76
-rw-r--r--en_HK/en_HK.go76
-rw-r--r--en_IE/en_IE.go76
-rw-r--r--en_IL/en_IL.go76
-rw-r--r--en_IM/en_IM.go76
-rw-r--r--en_IN/en_IN.go85
-rw-r--r--en_IO/en_IO.go78
-rw-r--r--en_JE/en_JE.go76
-rw-r--r--en_JM/en_JM.go78
-rw-r--r--en_KE/en_KE.go78
-rw-r--r--en_KI/en_KI.go78
-rw-r--r--en_KN/en_KN.go76
-rw-r--r--en_KY/en_KY.go76
-rw-r--r--en_LC/en_LC.go76
-rw-r--r--en_LR/en_LR.go76
-rw-r--r--en_LS/en_LS.go76
-rw-r--r--en_MG/en_MG.go78
-rw-r--r--en_MH/en_MH.go76
-rw-r--r--en_MO/en_MO.go76
-rw-r--r--en_MP/en_MP.go76
-rw-r--r--en_MS/en_MS.go76
-rw-r--r--en_MT/en_MT.go76
-rw-r--r--en_MU/en_MU.go76
-rw-r--r--en_MW/en_MW.go76
-rw-r--r--en_MY/en_MY.go76
-rw-r--r--en_NA/en_NA.go76
-rw-r--r--en_NF/en_NF.go76
-rw-r--r--en_NG/en_NG.go76
-rw-r--r--en_NL/en_NL.go80
-rw-r--r--en_NR/en_NR.go76
-rw-r--r--en_NU/en_NU.go76
-rw-r--r--en_NZ/en_NZ.go76
-rw-r--r--en_PG/en_PG.go76
-rw-r--r--en_PH/en_PH.go76
-rw-r--r--en_PK/en_PK.go76
-rw-r--r--en_PN/en_PN.go76
-rw-r--r--en_PR/en_PR.go78
-rw-r--r--en_PW/en_PW.go76
-rw-r--r--en_RW/en_RW.go76
-rw-r--r--en_SB/en_SB.go76
-rw-r--r--en_SC/en_SC.go76
-rw-r--r--en_SD/en_SD.go76
-rw-r--r--en_SE/en_SE.go79
-rw-r--r--en_SG/en_SG.go76
-rw-r--r--en_SH/en_SH.go76
-rw-r--r--en_SI/en_SI.go72
-rw-r--r--en_SL/en_SL.go76
-rw-r--r--en_SS/en_SS.go76
-rw-r--r--en_SX/en_SX.go78
-rw-r--r--en_SZ/en_SZ.go76
-rw-r--r--en_TC/en_TC.go76
-rw-r--r--en_TK/en_TK.go76
-rw-r--r--en_TO/en_TO.go78
-rw-r--r--en_TT/en_TT.go78
-rw-r--r--en_TV/en_TV.go76
-rw-r--r--en_TZ/en_TZ.go76
-rw-r--r--en_UG/en_UG.go78
-rw-r--r--en_UM/en_UM.go76
-rw-r--r--en_US/en_US.go76
-rw-r--r--en_US_POSIX/en_US_POSIX.go64
-rw-r--r--en_VC/en_VC.go76
-rw-r--r--en_VG/en_VG.go76
-rw-r--r--en_VI/en_VI.go76
-rw-r--r--en_VU/en_VU.go76
-rw-r--r--en_WS/en_WS.go76
-rw-r--r--en_ZA/en_ZA.go81
-rw-r--r--en_ZM/en_ZM.go76
-rw-r--r--en_ZW/en_ZW.go76
-rw-r--r--eo/eo.go65
-rw-r--r--eo_001/eo_001.go65
-rw-r--r--es/es.go72
-rw-r--r--es_419/es_419.go68
-rw-r--r--es_AR/es_AR.go80
-rw-r--r--es_BO/es_BO.go72
-rw-r--r--es_BR/es_BR.go72
-rw-r--r--es_CL/es_CL.go68
-rw-r--r--es_CO/es_CO.go76
-rw-r--r--es_CR/es_CR.go75
-rw-r--r--es_CU/es_CU.go72
-rw-r--r--es_DO/es_DO.go78
-rw-r--r--es_EA/es_EA.go72
-rw-r--r--es_EC/es_EC.go68
-rw-r--r--es_ES/es_ES.go72
-rw-r--r--es_GQ/es_GQ.go68
-rw-r--r--es_GT/es_GT.go55
-rw-r--r--es_HN/es_HN.go72
-rw-r--r--es_IC/es_IC.go72
-rw-r--r--es_MX/es_MX.go72
-rw-r--r--es_NI/es_NI.go72
-rw-r--r--es_PA/es_PA.go72
-rw-r--r--es_PE/es_PE.go72
-rw-r--r--es_PH/es_PH.go72
-rw-r--r--es_PR/es_PR.go72
-rw-r--r--es_PY/es_PY.go76
-rw-r--r--es_SV/es_SV.go72
-rw-r--r--es_US/es_US.go72
-rw-r--r--es_UY/es_UY.go80
-rw-r--r--es_VE/es_VE.go68
-rw-r--r--et/et.go77
-rw-r--r--et_EE/et_EE.go77
-rw-r--r--eu/eu.go74
-rw-r--r--eu_ES/eu_ES.go74
-rw-r--r--ewo/ewo.go77
-rw-r--r--ewo_CM/ewo_CM.go77
-rw-r--r--fa/fa.go84
-rw-r--r--fa_AF/fa_AF.go84
-rw-r--r--fa_IR/fa_IR.go84
-rw-r--r--ff/ff.go77
-rw-r--r--ff_CM/ff_CM.go77
-rw-r--r--ff_GN/ff_GN.go77
-rw-r--r--ff_MR/ff_MR.go77
-rw-r--r--ff_SN/ff_SN.go77
-rw-r--r--fi/fi.go77
-rw-r--r--fi_FI/fi_FI.go77
-rw-r--r--fil/fil.go76
-rw-r--r--fil_PH/fil_PH.go76
-rw-r--r--fo/fo.go74
-rw-r--r--fo_DK/fo_DK.go74
-rw-r--r--fo_FO/fo_FO.go74
-rw-r--r--fr/fr.go80
-rw-r--r--fr_BE/fr_BE.go77
-rw-r--r--fr_BF/fr_BF.go80
-rw-r--r--fr_BI/fr_BI.go80
-rw-r--r--fr_BJ/fr_BJ.go80
-rw-r--r--fr_BL/fr_BL.go80
-rw-r--r--fr_CA/fr_CA.go54
-rw-r--r--fr_CD/fr_CD.go80
-rw-r--r--fr_CF/fr_CF.go80
-rw-r--r--fr_CG/fr_CG.go80
-rw-r--r--fr_CH/fr_CH.go81
-rw-r--r--fr_CI/fr_CI.go80
-rw-r--r--fr_CM/fr_CM.go80
-rw-r--r--fr_DJ/fr_DJ.go80
-rw-r--r--fr_DZ/fr_DZ.go80
-rw-r--r--fr_FR/fr_FR.go80
-rw-r--r--fr_GA/fr_GA.go80
-rw-r--r--fr_GF/fr_GF.go80
-rw-r--r--fr_GN/fr_GN.go80
-rw-r--r--fr_GP/fr_GP.go80
-rw-r--r--fr_GQ/fr_GQ.go80
-rw-r--r--fr_HT/fr_HT.go80
-rw-r--r--fr_KM/fr_KM.go80
-rw-r--r--fr_LU/fr_LU.go77
-rw-r--r--fr_MA/fr_MA.go77
-rw-r--r--fr_MC/fr_MC.go80
-rw-r--r--fr_MF/fr_MF.go80
-rw-r--r--fr_MG/fr_MG.go80
-rw-r--r--fr_ML/fr_ML.go80
-rw-r--r--fr_MQ/fr_MQ.go80
-rw-r--r--fr_MR/fr_MR.go80
-rw-r--r--fr_MU/fr_MU.go80
-rw-r--r--fr_NC/fr_NC.go80
-rw-r--r--fr_NE/fr_NE.go80
-rw-r--r--fr_PF/fr_PF.go80
-rw-r--r--fr_PM/fr_PM.go80
-rw-r--r--fr_RE/fr_RE.go80
-rw-r--r--fr_RW/fr_RW.go80
-rw-r--r--fr_SC/fr_SC.go80
-rw-r--r--fr_SN/fr_SN.go80
-rw-r--r--fr_SY/fr_SY.go80
-rw-r--r--fr_TD/fr_TD.go80
-rw-r--r--fr_TG/fr_TG.go80
-rw-r--r--fr_TN/fr_TN.go80
-rw-r--r--fr_VU/fr_VU.go80
-rw-r--r--fr_WF/fr_WF.go80
-rw-r--r--fr_YT/fr_YT.go80
-rw-r--r--fur/fur.go76
-rw-r--r--fur_IT/fur_IT.go76
-rw-r--r--fy/fy.go80
-rw-r--r--fy_NL/fy_NL.go80
-rw-r--r--ga/ga.go76
-rw-r--r--ga_IE/ga_IE.go76
-rw-r--r--gd/gd.go82
-rw-r--r--gd_GB/gd_GB.go82
-rw-r--r--gl/gl.go72
-rw-r--r--gl_ES/gl_ES.go72
-rw-r--r--gsw/gsw.go77
-rw-r--r--gsw_CH/gsw_CH.go77
-rw-r--r--gsw_FR/gsw_FR.go77
-rw-r--r--gsw_LI/gsw_LI.go77
-rw-r--r--gu/gu.go91
-rw-r--r--gu_IN/gu_IN.go91
-rw-r--r--guz/guz.go82
-rw-r--r--guz_KE/guz_KE.go82
-rw-r--r--gv/gv.go76
-rw-r--r--gv_IM/gv_IM.go76
-rw-r--r--ha/ha.go78
-rw-r--r--ha_GH/ha_GH.go78
-rw-r--r--ha_NE/ha_NE.go78
-rw-r--r--ha_NG/ha_NG.go78
-rw-r--r--haw/haw.go82
-rw-r--r--haw_US/haw_US.go82
-rw-r--r--he/he.go74
-rw-r--r--he_IL/he_IL.go74
-rw-r--r--hi/hi.go77
-rw-r--r--hi_IN/hi_IN.go77
-rw-r--r--hr/hr.go72
-rw-r--r--hr_BA/hr_BA.go72
-rw-r--r--hr_HR/hr_HR.go72
-rw-r--r--hsb/hsb.go72
-rw-r--r--hsb_DE/hsb_DE.go72
-rw-r--r--hu/hu.go75
-rw-r--r--hu_HU/hu_HU.go75
-rw-r--r--hy/hy.go76
-rw-r--r--hy_AM/hy_AM.go76
-rw-r--r--id/id.go68
-rw-r--r--id_ID/id_ID.go68
-rw-r--r--ig/ig.go82
-rw-r--r--ig_NG/ig_NG.go82
-rw-r--r--ii/ii.go65
-rw-r--r--ii_CN/ii_CN.go65
-rw-r--r--is/is.go72
-rw-r--r--is_IS/is_IS.go72
-rw-r--r--it/it.go72
-rw-r--r--it_CH/it_CH.go76
-rw-r--r--it_IT/it_IT.go72
-rw-r--r--it_SM/it_SM.go72
-rw-r--r--ja/ja.go76
-rw-r--r--ja_JP/ja_JP.go76
-rw-r--r--jgo/jgo.go76
-rw-r--r--jgo_CM/jgo_CM.go76
-rw-r--r--jmc/jmc.go76
-rw-r--r--jmc_TZ/jmc_TZ.go76
-rw-r--r--ka/ka.go75
-rw-r--r--ka_GE/ka_GE.go75
-rw-r--r--kab/kab.go73
-rw-r--r--kab_DZ/kab_DZ.go73
-rw-r--r--kam/kam.go82
-rw-r--r--kam_KE/kam_KE.go82
-rw-r--r--kde/kde.go82
-rw-r--r--kde_TZ/kde_TZ.go82
-rw-r--r--kea/kea.go77
-rw-r--r--kea_CV/kea_CV.go77
-rw-r--r--khq/khq.go76
-rw-r--r--khq_ML/khq_ML.go76
-rw-r--r--ki/ki.go82
-rw-r--r--ki_KE/ki_KE.go82
-rw-r--r--kk/kk.go75
-rw-r--r--kk_KZ/kk_KZ.go75
-rw-r--r--kkj/kkj.go65
-rw-r--r--kkj_CM/kkj_CM.go65
-rw-r--r--kl/kl.go68
-rw-r--r--kl_GL/kl_GL.go68
-rw-r--r--kln/kln.go82
-rw-r--r--kln_KE/kln_KE.go82
-rw-r--r--km/km.go76
-rw-r--r--km_KH/km_KH.go76
-rw-r--r--kn/kn.go76
-rw-r--r--kn_IN/kn_IN.go76
-rw-r--r--ko/ko.go76
-rw-r--r--ko_KP/ko_KP.go76
-rw-r--r--ko_KR/ko_KR.go76
-rw-r--r--kok/kok.go93
-rw-r--r--kok_IN/kok_IN.go93
-rw-r--r--ks/ks.go87
-rw-r--r--ks_IN/ks_IN.go87
-rw-r--r--ksb/ksb.go76
-rw-r--r--ksb_TZ/ksb_TZ.go76
-rw-r--r--ksf/ksf.go77
-rw-r--r--ksf_CM/ksf_CM.go77
-rw-r--r--ksh/ksh.go77
-rw-r--r--ksh_DE/ksh_DE.go77
-rw-r--r--kw/kw.go76
-rw-r--r--kw_GB/kw_GB.go76
-rw-r--r--ky/ky.go75
-rw-r--r--ky_KG/ky_KG.go75
-rw-r--r--lag/lag.go68
-rw-r--r--lag_TZ/lag_TZ.go68
-rw-r--r--lb/lb.go72
-rw-r--r--lb_LU/lb_LU.go72
-rw-r--r--lg/lg.go76
-rw-r--r--lg_UG/lg_UG.go76
-rw-r--r--lkt/lkt.go63
-rw-r--r--lkt_US/lkt_US.go63
-rw-r--r--ln/ln.go72
-rw-r--r--ln_AO/ln_AO.go72
-rw-r--r--ln_CD/ln_CD.go72
-rw-r--r--ln_CF/ln_CF.go72
-rw-r--r--ln_CG/ln_CG.go72
-rw-r--r--lo/lo.go70
-rw-r--r--lo_LA/lo_LA.go70
-rw-r--r--lrc/lrc.go76
-rw-r--r--lrc_IQ/lrc_IQ.go76
-rw-r--r--lrc_IR/lrc_IR.go76
-rw-r--r--lt/lt.go77
-rw-r--r--lt_LT/lt_LT.go79
-rw-r--r--lu/lu.go70
-rw-r--r--lu_CD/lu_CD.go70
-rw-r--r--luo/luo.go76
-rw-r--r--luo_KE/luo_KE.go76
-rw-r--r--luy/luy.go76
-rw-r--r--luy_KE/luy_KE.go76
-rw-r--r--lv/lv.go64
-rw-r--r--lv_LV/lv_LV.go62
-rw-r--r--mas/mas.go82
-rw-r--r--mas_KE/mas_KE.go82
-rw-r--r--mas_TZ/mas_TZ.go82
-rw-r--r--mer/mer.go82
-rw-r--r--mer_KE/mer_KE.go82
-rw-r--r--mfe/mfe.go68
-rw-r--r--mfe_MU/mfe_MU.go68
-rw-r--r--mg/mg.go76
-rw-r--r--mg_MG/mg_MG.go76
-rw-r--r--mgh/mgh.go65
-rw-r--r--mgh_MZ/mgh_MZ.go65
-rw-r--r--mgo/mgo.go76
-rw-r--r--mgo_CM/mgo_CM.go76
-rw-r--r--mk/mk.go76
-rw-r--r--mk_MK/mk_MK.go78
-rw-r--r--ml/ml.go76
-rw-r--r--ml_IN/ml_IN.go76
-rw-r--r--mn/mn.go76
-rw-r--r--mn_MN/mn_MN.go76
-rw-r--r--mr/mr.go68
-rw-r--r--mr_IN/mr_IN.go68
-rw-r--r--ms/ms.go76
-rw-r--r--ms_BN/ms_BN.go76
-rw-r--r--ms_MY/ms_MY.go76
-rw-r--r--ms_SG/ms_SG.go76
-rw-r--r--mt/mt.go68
-rw-r--r--mt_MT/mt_MT.go68
-rw-r--r--mua/mua.go76
-rw-r--r--mua_CM/mua_CM.go76
-rw-r--r--my/my.go76
-rw-r--r--my_MM/my_MM.go76
-rw-r--r--mzn/mzn.go12
-rw-r--r--mzn_IR/mzn_IR.go12
-rw-r--r--naq/naq.go76
-rw-r--r--naq_NA/naq_NA.go76
-rw-r--r--nb/nb.go84
-rw-r--r--nb_NO/nb_NO.go84
-rw-r--r--nb_SJ/nb_SJ.go84
-rw-r--r--nd/nd.go82
-rw-r--r--nd_ZW/nd_ZW.go82
-rw-r--r--ne/ne.go76
-rw-r--r--ne_IN/ne_IN.go76
-rw-r--r--ne_NP/ne_NP.go76
-rw-r--r--nl/nl.go86
-rw-r--r--nl_AW/nl_AW.go86
-rw-r--r--nl_BE/nl_BE.go80
-rw-r--r--nl_BQ/nl_BQ.go86
-rw-r--r--nl_CW/nl_CW.go86
-rw-r--r--nl_NL/nl_NL.go86
-rw-r--r--nl_SR/nl_SR.go86
-rw-r--r--nl_SX/nl_SX.go86
-rw-r--r--nmg/nmg.go77
-rw-r--r--nmg_CM/nmg_CM.go77
-rw-r--r--nn/nn.go77
-rw-r--r--nn_NO/nn_NO.go77
-rw-r--r--nnh/nnh.go78
-rw-r--r--nnh_CM/nnh_CM.go78
-rw-r--r--nus/nus.go76
-rw-r--r--nus_SS/nus_SS.go76
-rw-r--r--nyn/nyn.go76
-rw-r--r--nyn_UG/nyn_UG.go76
-rw-r--r--om/om.go76
-rw-r--r--om_ET/om_ET.go76
-rw-r--r--om_KE/om_KE.go76
-rw-r--r--or/or.go87
-rw-r--r--or_IN/or_IN.go87
-rw-r--r--os/os.go79
-rw-r--r--os_GE/os_GE.go79
-rw-r--r--os_RU/os_RU.go79
-rw-r--r--pa/pa.go80
-rw-r--r--pa_Arab/pa_Arab.go68
-rw-r--r--pa_Arab_PK/pa_Arab_PK.go80
-rw-r--r--pa_Guru/pa_Guru.go80
-rw-r--r--pa_Guru_IN/pa_Guru_IN.go80
-rw-r--r--pl/pl.go77
-rw-r--r--pl_PL/pl_PL.go77
-rw-r--r--prg/prg.go77
-rw-r--r--prg_001/prg_001.go75
-rw-r--r--ps/ps.go80
-rw-r--r--ps_AF/ps_AF.go80
-rw-r--r--pt/pt.go76
-rw-r--r--pt_AO/pt_AO.go76
-rw-r--r--pt_BR/pt_BR.go76
-rw-r--r--pt_CH/pt_CH.go76
-rw-r--r--pt_CV/pt_CV.go76
-rw-r--r--pt_GQ/pt_GQ.go76
-rw-r--r--pt_GW/pt_GW.go76
-rw-r--r--pt_LU/pt_LU.go76
-rw-r--r--pt_MO/pt_MO.go76
-rw-r--r--pt_MZ/pt_MZ.go76
-rw-r--r--pt_PT/pt_PT.go77
-rw-r--r--pt_ST/pt_ST.go76
-rw-r--r--pt_TL/pt_TL.go76
-rw-r--r--qu/qu.go76
-rw-r--r--qu_BO/qu_BO.go76
-rw-r--r--qu_EC/qu_EC.go76
-rw-r--r--qu_PE/qu_PE.go76
-rw-r--r--rm/rm.go77
-rw-r--r--rm_CH/rm_CH.go77
-rw-r--r--rn/rn.go70
-rw-r--r--rn_BI/rn_BI.go70
-rw-r--r--ro/ro.go74
-rw-r--r--ro_MD/ro_MD.go74
-rw-r--r--ro_RO/ro_RO.go74
-rw-r--r--rof/rof.go76
-rw-r--r--rof_TZ/rof_TZ.go76
-rw-r--r--root/root.go12
-rw-r--r--ru/ru.go75
-rw-r--r--ru_BY/ru_BY.go75
-rw-r--r--ru_KG/ru_KG.go77
-rw-r--r--ru_KZ/ru_KZ.go75
-rw-r--r--ru_MD/ru_MD.go75
-rw-r--r--ru_RU/ru_RU.go75
-rw-r--r--ru_UA/ru_UA.go75
-rw-r--r--rules.go5
-rw-r--r--rw/rw.go65
-rw-r--r--rw_RW/rw_RW.go65
-rw-r--r--rwk/rwk.go76
-rw-r--r--rwk_TZ/rwk_TZ.go76
-rw-r--r--sah/sah.go65
-rw-r--r--sah_RU/sah_RU.go65
-rw-r--r--saq/saq.go82
-rw-r--r--saq_KE/saq_KE.go82
-rw-r--r--sbp/sbp.go70
-rw-r--r--sbp_TZ/sbp_TZ.go70
-rw-r--r--se/se.go77
-rw-r--r--se_FI/se_FI.go77
-rw-r--r--se_NO/se_NO.go77
-rw-r--r--se_SE/se_SE.go77
-rw-r--r--seh/seh.go70
-rw-r--r--seh_MZ/seh_MZ.go70
-rw-r--r--ses/ses.go76
-rw-r--r--ses_ML/ses_ML.go76
-rw-r--r--sg/sg.go70
-rw-r--r--sg_CF/sg_CF.go70
-rw-r--r--shi/shi.go73
-rw-r--r--shi_Latn/shi_Latn.go73
-rw-r--r--shi_Latn_MA/shi_Latn_MA.go73
-rw-r--r--shi_Tfng/shi_Tfng.go73
-rw-r--r--shi_Tfng_MA/shi_Tfng_MA.go73
-rw-r--r--si/si.go76
-rw-r--r--si_LK/si_LK.go76
-rw-r--r--sk/sk.go77
-rw-r--r--sk_SK/sk_SK.go77
-rw-r--r--sl/sl.go74
-rw-r--r--sl_SI/sl_SI.go74
-rw-r--r--smn/smn.go68
-rw-r--r--smn_FI/smn_FI.go68
-rw-r--r--sn/sn.go82
-rw-r--r--sn_ZW/sn_ZW.go82
-rw-r--r--so/so.go70
-rw-r--r--so_DJ/so_DJ.go70
-rw-r--r--so_ET/so_ET.go70
-rw-r--r--so_KE/so_KE.go70
-rw-r--r--so_SO/so_SO.go70
-rw-r--r--sq/sq.go77
-rw-r--r--sq_AL/sq_AL.go79
-rw-r--r--sq_MK/sq_MK.go77
-rw-r--r--sq_XK/sq_XK.go77
-rw-r--r--sr/sr.go74
-rw-r--r--sr_Cyrl/sr_Cyrl.go78
-rw-r--r--sr_Cyrl_BA/sr_Cyrl_BA.go74
-rw-r--r--sr_Cyrl_ME/sr_Cyrl_ME.go78
-rw-r--r--sr_Cyrl_RS/sr_Cyrl_RS.go74
-rw-r--r--sr_Cyrl_XK/sr_Cyrl_XK.go76
-rw-r--r--sr_Latn/sr_Latn.go74
-rw-r--r--sr_Latn_BA/sr_Latn_BA.go78
-rw-r--r--sr_Latn_ME/sr_Latn_ME.go74
-rw-r--r--sr_Latn_RS/sr_Latn_RS.go74
-rw-r--r--sr_Latn_XK/sr_Latn_XK.go76
-rw-r--r--sv/sv.go82
-rw-r--r--sv_AX/sv_AX.go80
-rw-r--r--sv_FI/sv_FI.go82
-rw-r--r--sv_SE/sv_SE.go80
-rw-r--r--sw/sw.go76
-rw-r--r--sw_CD/sw_CD.go76
-rw-r--r--sw_KE/sw_KE.go76
-rw-r--r--sw_TZ/sw_TZ.go76
-rw-r--r--sw_UG/sw_UG.go76
-rw-r--r--ta/ta.go76
-rw-r--r--ta_IN/ta_IN.go76
-rw-r--r--ta_LK/ta_LK.go76
-rw-r--r--ta_MY/ta_MY.go76
-rw-r--r--ta_SG/ta_SG.go76
-rw-r--r--te/te.go85
-rw-r--r--te_IN/te_IN.go85
-rw-r--r--teo/teo.go82
-rw-r--r--teo_KE/teo_KE.go82
-rw-r--r--teo_UG/teo_UG.go82
-rw-r--r--th/th.go76
-rw-r--r--th_TH/th_TH.go76
-rw-r--r--ti/ti.go76
-rw-r--r--ti_ER/ti_ER.go76
-rw-r--r--ti_ET/ti_ET.go76
-rw-r--r--tk/tk.go75
-rw-r--r--tk_TM/tk_TM.go75
-rw-r--r--to/to.go76
-rw-r--r--to_TO/to_TO.go76
-rw-r--r--tr/tr.go74
-rw-r--r--tr_CY/tr_CY.go74
-rw-r--r--tr_TR/tr_TR.go74
-rw-r--r--twq/twq.go73
-rw-r--r--twq_NE/twq_NE.go73
-rw-r--r--tzm/tzm.go77
-rw-r--r--tzm_MA/tzm_MA.go77
-rw-r--r--ug/ug.go76
-rw-r--r--ug_CN/ug_CN.go76
-rw-r--r--uk/uk.go77
-rw-r--r--uk_UA/uk_UA.go75
-rw-r--r--ur/ur.go87
-rw-r--r--ur_IN/ur_IN.go87
-rw-r--r--ur_PK/ur_PK.go87
-rw-r--r--uz/uz.go82
-rw-r--r--uz_Arab/uz_Arab.go78
-rw-r--r--uz_Arab_AF/uz_Arab_AF.go82
-rw-r--r--uz_Cyrl/uz_Cyrl.go82
-rw-r--r--uz_Cyrl_UZ/uz_Cyrl_UZ.go82
-rw-r--r--uz_Latn/uz_Latn.go82
-rw-r--r--uz_Latn_UZ/uz_Latn_UZ.go82
-rw-r--r--vai/vai.go76
-rw-r--r--vai_Latn/vai_Latn.go76
-rw-r--r--vai_Latn_LR/vai_Latn_LR.go76
-rw-r--r--vai_Vaii/vai_Vaii.go76
-rw-r--r--vai_Vaii_LR/vai_Vaii_LR.go76
-rw-r--r--vi/vi.go72
-rw-r--r--vi_VN/vi_VN.go72
-rw-r--r--vo/vo.go12
-rw-r--r--vo_001/vo_001.go12
-rw-r--r--vun/vun.go76
-rw-r--r--vun_TZ/vun_TZ.go76
-rw-r--r--wae/wae.go65
-rw-r--r--wae_CH/wae_CH.go65
-rw-r--r--xog/xog.go80
-rw-r--r--xog_UG/xog_UG.go80
-rw-r--r--yav/yav.go77
-rw-r--r--yav_CM/yav_CM.go77
-rw-r--r--yi/yi.go63
-rw-r--r--yi_001/yi_001.go63
-rw-r--r--yo/yo.go82
-rw-r--r--yo_BJ/yo_BJ.go82
-rw-r--r--yo_NG/yo_NG.go82
-rw-r--r--yue/yue.go76
-rw-r--r--yue_HK/yue_HK.go76
-rw-r--r--zgh/zgh.go73
-rw-r--r--zgh_MA/zgh_MA.go73
-rw-r--r--zh/zh.go76
-rw-r--r--zh_Hans/zh_Hans.go76
-rw-r--r--zh_Hans_CN/zh_Hans_CN.go76
-rw-r--r--zh_Hans_HK/zh_Hans_HK.go76
-rw-r--r--zh_Hans_MO/zh_Hans_MO.go76
-rw-r--r--zh_Hans_SG/zh_Hans_SG.go76
-rw-r--r--zh_Hant/zh_Hant.go76
-rw-r--r--zh_Hant_HK/zh_Hant_HK.go55
-rw-r--r--zh_Hant_MO/zh_Hant_MO.go76
-rw-r--r--zh_Hant_TW/zh_Hant_TW.go76
-rw-r--r--zu/zu.go76
-rw-r--r--zu_ZA/zu_ZA.go76
719 files changed, 54430 insertions, 59 deletions
diff --git a/af/af.go b/af/af.go
index 4e6ee604..ab843750 100644
--- a/af/af.go
+++ b/af/af.go
@@ -225,3 +225,82 @@ func (af *af) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'af'
+// 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 (af *af) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := af.currencies[currency]
+ l := len(s) + len(af.decimal) + len(af.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, af.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(af.group) - 1; j >= 0; j-- {
+ b = append(b, af.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(af.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, af.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, af.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, af.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/af_NA/af_NA.go b/af_NA/af_NA.go
index d89e21a6..07a9a2cc 100644
--- a/af_NA/af_NA.go
+++ b/af_NA/af_NA.go
@@ -225,3 +225,82 @@ func (af *af_NA) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'af_NA'
+// 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 (af *af_NA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := af.currencies[currency]
+ l := len(s) + len(af.decimal) + len(af.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, af.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(af.group) - 1; j >= 0; j-- {
+ b = append(b, af.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(af.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, af.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, af.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, af.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/af_ZA/af_ZA.go b/af_ZA/af_ZA.go
index 0e4dc608..7855e79d 100644
--- a/af_ZA/af_ZA.go
+++ b/af_ZA/af_ZA.go
@@ -225,3 +225,82 @@ func (af *af_ZA) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'af_ZA'
+// 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 (af *af_ZA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := af.currencies[currency]
+ l := len(s) + len(af.decimal) + len(af.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, af.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(af.group) - 1; j >= 0; j-- {
+ b = append(b, af.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(af.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, af.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, af.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, af.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/agq/agq.go b/agq/agq.go
index 6d7d9863..e299e49d 100644
--- a/agq/agq.go
+++ b/agq/agq.go
@@ -218,3 +218,76 @@ func (agq *agq) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'agq'
+// 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 (agq *agq) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := agq.currencies[currency]
+ l := len(s) + len(agq.decimal) + len(agq.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, agq.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(agq.group) - 1; j >= 0; j-- {
+ b = append(b, agq.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(agq.minus) - 1; j >= 0; j-- {
+ b = append(b, agq.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, agq.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/agq_CM/agq_CM.go b/agq_CM/agq_CM.go
index 4f8d23b1..80adb100 100644
--- a/agq_CM/agq_CM.go
+++ b/agq_CM/agq_CM.go
@@ -218,3 +218,76 @@ func (agq *agq_CM) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'agq_CM'
+// 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 (agq *agq_CM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := agq.currencies[currency]
+ l := len(s) + len(agq.decimal) + len(agq.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, agq.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(agq.group) - 1; j >= 0; j-- {
+ b = append(b, agq.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(agq.minus) - 1; j >= 0; j-- {
+ b = append(b, agq.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, agq.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ak/ak.go b/ak/ak.go
index a6de3fe1..8301cc5b 100644
--- a/ak/ak.go
+++ b/ak/ak.go
@@ -157,3 +157,73 @@ func (ak *ak) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ak'
+// 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 (ak *ak) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ak.currencies[currency]
+ l := len(s) + len(ak.decimal) + len(ak.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ak.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ak.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ak.minus) - 1; j >= 0; j-- {
+ b = append(b, ak.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ak.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ak_GH/ak_GH.go b/ak_GH/ak_GH.go
index d98a4352..13274cc5 100644
--- a/ak_GH/ak_GH.go
+++ b/ak_GH/ak_GH.go
@@ -157,3 +157,73 @@ func (ak *ak_GH) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ak_GH'
+// 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 (ak *ak_GH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ak.currencies[currency]
+ l := len(s) + len(ak.decimal) + len(ak.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ak.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ak.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ak.minus) - 1; j >= 0; j-- {
+ b = append(b, ak.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ak.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/am/am.go b/am/am.go
index 4d15a88c..bd8d98cf 100644
--- a/am/am.go
+++ b/am/am.go
@@ -231,3 +231,79 @@ func (am *am) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'am'
+// 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 (am *am) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := am.currencies[currency]
+ l := len(s) + len(am.decimal) + len(am.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, am.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, am.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(am.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, am.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, am.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, am.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/am_ET/am_ET.go b/am_ET/am_ET.go
index 0f041f23..901fff7f 100644
--- a/am_ET/am_ET.go
+++ b/am_ET/am_ET.go
@@ -231,3 +231,79 @@ func (am *am_ET) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'am_ET'
+// 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 (am *am_ET) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := am.currencies[currency]
+ l := len(s) + len(am.decimal) + len(am.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, am.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, am.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(am.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, am.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, am.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, am.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ar/ar.go b/ar/ar.go
index 52ec8315..91984584 100644
--- a/ar/ar.go
+++ b/ar/ar.go
@@ -304,3 +304,87 @@ func (ar *ar) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar'
+// 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 (ar *ar) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_001/ar_001.go b/ar_001/ar_001.go
index f5030735..8349348c 100644
--- a/ar_001/ar_001.go
+++ b/ar_001/ar_001.go
@@ -304,3 +304,87 @@ func (ar *ar_001) FmtCurrency(num float64, v uint64, currency currency.Type) []b
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_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 (ar *ar_001) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_AE/ar_AE.go b/ar_AE/ar_AE.go
index 57c13606..a06257b3 100644
--- a/ar_AE/ar_AE.go
+++ b/ar_AE/ar_AE.go
@@ -304,3 +304,87 @@ func (ar *ar_AE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_AE'
+// 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 (ar *ar_AE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_BH/ar_BH.go b/ar_BH/ar_BH.go
index a5f41334..33546fb8 100644
--- a/ar_BH/ar_BH.go
+++ b/ar_BH/ar_BH.go
@@ -304,3 +304,87 @@ func (ar *ar_BH) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_BH'
+// 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 (ar *ar_BH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_DJ/ar_DJ.go b/ar_DJ/ar_DJ.go
index 28e59a22..59dae80a 100644
--- a/ar_DJ/ar_DJ.go
+++ b/ar_DJ/ar_DJ.go
@@ -304,3 +304,87 @@ func (ar *ar_DJ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_DJ'
+// 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 (ar *ar_DJ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_DZ/ar_DZ.go b/ar_DZ/ar_DZ.go
index 8bcb3e66..e3468c76 100644
--- a/ar_DZ/ar_DZ.go
+++ b/ar_DZ/ar_DZ.go
@@ -289,3 +289,81 @@ func (ar *ar_DZ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_DZ'
+// 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 (ar *ar_DZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ar.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ar.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_EG/ar_EG.go b/ar_EG/ar_EG.go
index e019c145..dcdd6ae3 100644
--- a/ar_EG/ar_EG.go
+++ b/ar_EG/ar_EG.go
@@ -304,3 +304,87 @@ func (ar *ar_EG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_EG'
+// 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 (ar *ar_EG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_EH/ar_EH.go b/ar_EH/ar_EH.go
index 2b03bc8f..6f917eef 100644
--- a/ar_EH/ar_EH.go
+++ b/ar_EH/ar_EH.go
@@ -304,3 +304,87 @@ func (ar *ar_EH) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_EH'
+// 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 (ar *ar_EH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_ER/ar_ER.go b/ar_ER/ar_ER.go
index f783dbb0..cb97c3f8 100644
--- a/ar_ER/ar_ER.go
+++ b/ar_ER/ar_ER.go
@@ -304,3 +304,87 @@ func (ar *ar_ER) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_ER'
+// 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 (ar *ar_ER) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_IL/ar_IL.go b/ar_IL/ar_IL.go
index 1494fcb0..2eb2c043 100644
--- a/ar_IL/ar_IL.go
+++ b/ar_IL/ar_IL.go
@@ -304,3 +304,87 @@ func (ar *ar_IL) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_IL'
+// 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 (ar *ar_IL) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_IQ/ar_IQ.go b/ar_IQ/ar_IQ.go
index 1c9c5f6d..c2305216 100644
--- a/ar_IQ/ar_IQ.go
+++ b/ar_IQ/ar_IQ.go
@@ -304,3 +304,87 @@ func (ar *ar_IQ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_IQ'
+// 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 (ar *ar_IQ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_JO/ar_JO.go b/ar_JO/ar_JO.go
index 940337ff..fc6087bf 100644
--- a/ar_JO/ar_JO.go
+++ b/ar_JO/ar_JO.go
@@ -304,3 +304,87 @@ func (ar *ar_JO) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_JO'
+// 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 (ar *ar_JO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_KM/ar_KM.go b/ar_KM/ar_KM.go
index a6360d54..e0954d7b 100644
--- a/ar_KM/ar_KM.go
+++ b/ar_KM/ar_KM.go
@@ -304,3 +304,87 @@ func (ar *ar_KM) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_KM'
+// 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 (ar *ar_KM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_KW/ar_KW.go b/ar_KW/ar_KW.go
index b15868b3..c96f852f 100644
--- a/ar_KW/ar_KW.go
+++ b/ar_KW/ar_KW.go
@@ -304,3 +304,87 @@ func (ar *ar_KW) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_KW'
+// 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 (ar *ar_KW) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_LB/ar_LB.go b/ar_LB/ar_LB.go
index 3199a6fe..0d8b09b3 100644
--- a/ar_LB/ar_LB.go
+++ b/ar_LB/ar_LB.go
@@ -289,3 +289,81 @@ func (ar *ar_LB) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_LB'
+// 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 (ar *ar_LB) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ar.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ar.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_LY/ar_LY.go b/ar_LY/ar_LY.go
index 43a19637..59d2d5c3 100644
--- a/ar_LY/ar_LY.go
+++ b/ar_LY/ar_LY.go
@@ -289,3 +289,81 @@ func (ar *ar_LY) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_LY'
+// 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 (ar *ar_LY) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ar.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ar.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_MA/ar_MA.go b/ar_MA/ar_MA.go
index 935fc943..5f9c8758 100644
--- a/ar_MA/ar_MA.go
+++ b/ar_MA/ar_MA.go
@@ -289,3 +289,81 @@ func (ar *ar_MA) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_MA'
+// 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 (ar *ar_MA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ar.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ar.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_MR/ar_MR.go b/ar_MR/ar_MR.go
index f8ab9df6..7d3ec439 100644
--- a/ar_MR/ar_MR.go
+++ b/ar_MR/ar_MR.go
@@ -289,3 +289,81 @@ func (ar *ar_MR) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_MR'
+// 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 (ar *ar_MR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ar.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ar.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_OM/ar_OM.go b/ar_OM/ar_OM.go
index 277995fa..6963f86e 100644
--- a/ar_OM/ar_OM.go
+++ b/ar_OM/ar_OM.go
@@ -304,3 +304,87 @@ func (ar *ar_OM) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_OM'
+// 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 (ar *ar_OM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_PS/ar_PS.go b/ar_PS/ar_PS.go
index 4fa9adc5..d23b0b0f 100644
--- a/ar_PS/ar_PS.go
+++ b/ar_PS/ar_PS.go
@@ -304,3 +304,87 @@ func (ar *ar_PS) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_PS'
+// 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 (ar *ar_PS) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_QA/ar_QA.go b/ar_QA/ar_QA.go
index 180f82ea..04a5f104 100644
--- a/ar_QA/ar_QA.go
+++ b/ar_QA/ar_QA.go
@@ -304,3 +304,87 @@ func (ar *ar_QA) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_QA'
+// 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 (ar *ar_QA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_SA/ar_SA.go b/ar_SA/ar_SA.go
index f9a46a1b..18cf1941 100644
--- a/ar_SA/ar_SA.go
+++ b/ar_SA/ar_SA.go
@@ -304,3 +304,87 @@ func (ar *ar_SA) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_SA'
+// 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 (ar *ar_SA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_SD/ar_SD.go b/ar_SD/ar_SD.go
index 74108681..53a79b35 100644
--- a/ar_SD/ar_SD.go
+++ b/ar_SD/ar_SD.go
@@ -304,3 +304,87 @@ func (ar *ar_SD) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_SD'
+// 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 (ar *ar_SD) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_SO/ar_SO.go b/ar_SO/ar_SO.go
index 4af7b089..b179e11a 100644
--- a/ar_SO/ar_SO.go
+++ b/ar_SO/ar_SO.go
@@ -304,3 +304,87 @@ func (ar *ar_SO) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_SO'
+// 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 (ar *ar_SO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_SS/ar_SS.go b/ar_SS/ar_SS.go
index 77134930..082f5037 100644
--- a/ar_SS/ar_SS.go
+++ b/ar_SS/ar_SS.go
@@ -304,3 +304,87 @@ func (ar *ar_SS) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_SS'
+// 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 (ar *ar_SS) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_SY/ar_SY.go b/ar_SY/ar_SY.go
index f55b66ac..8e7cf794 100644
--- a/ar_SY/ar_SY.go
+++ b/ar_SY/ar_SY.go
@@ -304,3 +304,87 @@ func (ar *ar_SY) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_SY'
+// 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 (ar *ar_SY) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_TD/ar_TD.go b/ar_TD/ar_TD.go
index 8c71747d..8d661ef6 100644
--- a/ar_TD/ar_TD.go
+++ b/ar_TD/ar_TD.go
@@ -304,3 +304,87 @@ func (ar *ar_TD) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_TD'
+// 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 (ar *ar_TD) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_TN/ar_TN.go b/ar_TN/ar_TN.go
index e7286f63..132f0ff5 100644
--- a/ar_TN/ar_TN.go
+++ b/ar_TN/ar_TN.go
@@ -289,3 +289,81 @@ func (ar *ar_TN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_TN'
+// 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 (ar *ar_TN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ar.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ar.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ar_YE/ar_YE.go b/ar_YE/ar_YE.go
index 5b41728e..2b2b0531 100644
--- a/ar_YE/ar_YE.go
+++ b/ar_YE/ar_YE.go
@@ -304,3 +304,87 @@ func (ar *ar_YE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ar_YE'
+// 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 (ar *ar_YE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ar.currencies[currency]
+ l := len(s) + len(ar.decimal) + len(ar.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ar.decimal) - 1; j >= 0; j-- {
+ b = append(b, ar.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ar.group) - 1; j >= 0; j-- {
+ b = append(b, ar.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyNegativePrefix[j])
+ }
+
+ for j := len(ar.minus) - 1; j >= 0; j-- {
+ b = append(b, ar.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ar.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ar.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ar.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/as/as.go b/as/as.go
index ea3af11b..ede39d07 100644
--- a/as/as.go
+++ b/as/as.go
@@ -276,3 +276,96 @@ func (as *as) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'as'
+// 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 (as *as) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := as.currencies[currency]
+ l := len(s) + len(as.decimal) + len(as.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(as.decimal) - 1; j >= 0; j-- {
+ b = append(b, as.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ for j := len(as.group) - 1; j >= 0; j-- {
+ b = append(b, as.group[j])
+ }
+
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(as.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, as.currencyNegativePrefix[j])
+ }
+
+ for j := len(as.minus) - 1; j >= 0; j-- {
+ b = append(b, as.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(as.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, as.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, as.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/as_IN/as_IN.go b/as_IN/as_IN.go
index 54ace5fc..27fdc676 100644
--- a/as_IN/as_IN.go
+++ b/as_IN/as_IN.go
@@ -276,3 +276,96 @@ func (as *as_IN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'as_IN'
+// 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 (as *as_IN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := as.currencies[currency]
+ l := len(s) + len(as.decimal) + len(as.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(as.decimal) - 1; j >= 0; j-- {
+ b = append(b, as.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ for j := len(as.group) - 1; j >= 0; j-- {
+ b = append(b, as.group[j])
+ }
+
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(as.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, as.currencyNegativePrefix[j])
+ }
+
+ for j := len(as.minus) - 1; j >= 0; j-- {
+ b = append(b, as.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(as.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, as.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, as.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/asa/asa.go b/asa/asa.go
index a38eb542..509cf284 100644
--- a/asa/asa.go
+++ b/asa/asa.go
@@ -167,3 +167,83 @@ func (asa *asa) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'asa'
+// 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 (asa *asa) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := asa.currencies[currency]
+ l := len(s) + len(asa.decimal) + len(asa.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(asa.decimal) - 1; j >= 0; j-- {
+ b = append(b, asa.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(asa.group) - 1; j >= 0; j-- {
+ b = append(b, asa.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(asa.minus) - 1; j >= 0; j-- {
+ b = append(b, asa.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, asa.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, asa.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, asa.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/asa_TZ/asa_TZ.go b/asa_TZ/asa_TZ.go
index fbdeb3f1..7de9955b 100644
--- a/asa_TZ/asa_TZ.go
+++ b/asa_TZ/asa_TZ.go
@@ -167,3 +167,83 @@ func (asa *asa_TZ) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'asa_TZ'
+// 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 (asa *asa_TZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := asa.currencies[currency]
+ l := len(s) + len(asa.decimal) + len(asa.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(asa.decimal) - 1; j >= 0; j-- {
+ b = append(b, asa.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(asa.group) - 1; j >= 0; j-- {
+ b = append(b, asa.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(asa.minus) - 1; j >= 0; j-- {
+ b = append(b, asa.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, asa.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, asa.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, asa.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ast/ast.go b/ast/ast.go
index d0610616..0073062a 100644
--- a/ast/ast.go
+++ b/ast/ast.go
@@ -241,3 +241,83 @@ func (ast *ast) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ast'
+// 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 (ast *ast) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ast.currencies[currency]
+ l := len(s) + len(ast.decimal) + len(ast.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ast.decimal) - 1; j >= 0; j-- {
+ b = append(b, ast.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ast.group) - 1; j >= 0; j-- {
+ b = append(b, ast.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ast.minus) - 1; j >= 0; j-- {
+ b = append(b, ast.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ast.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ast.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ast.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ast_ES/ast_ES.go b/ast_ES/ast_ES.go
index 9e7a74a5..9be918d3 100644
--- a/ast_ES/ast_ES.go
+++ b/ast_ES/ast_ES.go
@@ -241,3 +241,83 @@ func (ast *ast_ES) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ast_ES'
+// 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 (ast *ast_ES) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ast.currencies[currency]
+ l := len(s) + len(ast.decimal) + len(ast.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ast.decimal) - 1; j >= 0; j-- {
+ b = append(b, ast.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ast.group) - 1; j >= 0; j-- {
+ b = append(b, ast.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ast.minus) - 1; j >= 0; j-- {
+ b = append(b, ast.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ast.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ast.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ast.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/az/az.go b/az/az.go
index b2a0b693..22e369c1 100644
--- a/az/az.go
+++ b/az/az.go
@@ -76,9 +76,9 @@ func (az *az) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
i := int64(n)
+ iMod100 := i % 100
iMod1000 := i % 1000
iMod10 := i % 10
- iMod100 := i % 100
if (iMod10 == 1 || iMod10 == 2 || iMod10 == 5 || iMod10 == 7 || iMod10 == 8) || (iMod100 == 20 || iMod100 == 50 || iMod100 == 70 || iMod100 == 80) {
return locales.PluralRuleOne
@@ -249,3 +249,79 @@ func (az *az) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'az'
+// 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 (az *az) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := az.currencies[currency]
+ l := len(s) + len(az.decimal) + len(az.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, az.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, az.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(az.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, az.currencyNegativePrefix[j])
+ }
+
+ b = append(b, az.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(az.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, az.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, az.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/az_Cyrl/az_Cyrl.go b/az_Cyrl/az_Cyrl.go
index 4be0baa3..97187b3e 100644
--- a/az_Cyrl/az_Cyrl.go
+++ b/az_Cyrl/az_Cyrl.go
@@ -76,9 +76,9 @@ func (az *az_Cyrl) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
i := int64(n)
- iMod10 := i % 10
iMod100 := i % 100
iMod1000 := i % 1000
+ iMod10 := i % 10
if (iMod10 == 1 || iMod10 == 2 || iMod10 == 5 || iMod10 == 7 || iMod10 == 8) || (iMod100 == 20 || iMod100 == 50 || iMod100 == 70 || iMod100 == 80) {
return locales.PluralRuleOne
@@ -249,3 +249,79 @@ func (az *az_Cyrl) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'az_Cyrl'
+// 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 (az *az_Cyrl) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := az.currencies[currency]
+ l := len(s) + len(az.decimal) + len(az.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, az.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, az.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(az.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, az.currencyNegativePrefix[j])
+ }
+
+ b = append(b, az.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(az.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, az.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, az.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/az_Cyrl_AZ/az_Cyrl_AZ.go b/az_Cyrl_AZ/az_Cyrl_AZ.go
index 34f0a349..6df70bd0 100644
--- a/az_Cyrl_AZ/az_Cyrl_AZ.go
+++ b/az_Cyrl_AZ/az_Cyrl_AZ.go
@@ -249,3 +249,79 @@ func (az *az_Cyrl_AZ) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'az_Cyrl_AZ'
+// 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 (az *az_Cyrl_AZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := az.currencies[currency]
+ l := len(s) + len(az.decimal) + len(az.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, az.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, az.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(az.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, az.currencyNegativePrefix[j])
+ }
+
+ b = append(b, az.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(az.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, az.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, az.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/az_Latn/az_Latn.go b/az_Latn/az_Latn.go
index 96e65cc9..b28013dd 100644
--- a/az_Latn/az_Latn.go
+++ b/az_Latn/az_Latn.go
@@ -76,9 +76,9 @@ func (az *az_Latn) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
i := int64(n)
+ iMod100 := i % 100
iMod1000 := i % 1000
iMod10 := i % 10
- iMod100 := i % 100
if (iMod10 == 1 || iMod10 == 2 || iMod10 == 5 || iMod10 == 7 || iMod10 == 8) || (iMod100 == 20 || iMod100 == 50 || iMod100 == 70 || iMod100 == 80) {
return locales.PluralRuleOne
@@ -249,3 +249,79 @@ func (az *az_Latn) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'az_Latn'
+// 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 (az *az_Latn) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := az.currencies[currency]
+ l := len(s) + len(az.decimal) + len(az.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, az.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, az.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(az.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, az.currencyNegativePrefix[j])
+ }
+
+ b = append(b, az.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(az.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, az.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, az.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/az_Latn_AZ/az_Latn_AZ.go b/az_Latn_AZ/az_Latn_AZ.go
index 9f501bf8..e2c43418 100644
--- a/az_Latn_AZ/az_Latn_AZ.go
+++ b/az_Latn_AZ/az_Latn_AZ.go
@@ -76,9 +76,9 @@ func (az *az_Latn_AZ) OrdinalPluralRule(num float64, v uint64) locales.PluralRul
n := math.Abs(num)
i := int64(n)
+ iMod10 := i % 10
iMod100 := i % 100
iMod1000 := i % 1000
- iMod10 := i % 10
if (iMod10 == 1 || iMod10 == 2 || iMod10 == 5 || iMod10 == 7 || iMod10 == 8) || (iMod100 == 20 || iMod100 == 50 || iMod100 == 70 || iMod100 == 80) {
return locales.PluralRuleOne
@@ -249,3 +249,79 @@ func (az *az_Latn_AZ) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'az_Latn_AZ'
+// 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 (az *az_Latn_AZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := az.currencies[currency]
+ l := len(s) + len(az.decimal) + len(az.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, az.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, az.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(az.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, az.currencyNegativePrefix[j])
+ }
+
+ b = append(b, az.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(az.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, az.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, az.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/bas/bas.go b/bas/bas.go
index fd98987c..0cd6d434 100644
--- a/bas/bas.go
+++ b/bas/bas.go
@@ -228,3 +228,80 @@ func (bas *bas) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bas'
+// 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 (bas *bas) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bas.currencies[currency]
+ l := len(s) + len(bas.decimal) + len(bas.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, bas.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(bas.group) - 1; j >= 0; j-- {
+ b = append(b, bas.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(bas.minus) - 1; j >= 0; j-- {
+ b = append(b, bas.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bas.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, bas.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, bas.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/bas_CM/bas_CM.go b/bas_CM/bas_CM.go
index 566a2567..fb6e6dee 100644
--- a/bas_CM/bas_CM.go
+++ b/bas_CM/bas_CM.go
@@ -228,3 +228,80 @@ func (bas *bas_CM) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bas_CM'
+// 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 (bas *bas_CM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bas.currencies[currency]
+ l := len(s) + len(bas.decimal) + len(bas.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, bas.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(bas.group) - 1; j >= 0; j-- {
+ b = append(b, bas.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(bas.minus) - 1; j >= 0; j-- {
+ b = append(b, bas.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bas.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, bas.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, bas.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/be/be.go b/be/be.go
index b363556f..7ca17858 100644
--- a/be/be.go
+++ b/be/be.go
@@ -244,3 +244,82 @@ func (be *be) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'be'
+// 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 (be *be) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := be.currencies[currency]
+ l := len(s) + len(be.decimal) + len(be.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, be.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(be.group) - 1; j >= 0; j-- {
+ b = append(b, be.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(be.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, be.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, be.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, be.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/be_BY/be_BY.go b/be_BY/be_BY.go
index b451cbfd..8dfc8628 100644
--- a/be_BY/be_BY.go
+++ b/be_BY/be_BY.go
@@ -65,8 +65,8 @@ func (be *be_BY) PluralsOrdinal() []locales.PluralRule {
func (be *be_BY) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod10 := math.Mod(n, 10)
nMod100 := math.Mod(n, 100)
+ nMod10 := math.Mod(n, 10)
if nMod10 == 1 && nMod100 != 11 {
return locales.PluralRuleOne
@@ -244,3 +244,82 @@ func (be *be_BY) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'be_BY'
+// 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 (be *be_BY) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := be.currencies[currency]
+ l := len(s) + len(be.decimal) + len(be.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, be.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(be.group) - 1; j >= 0; j-- {
+ b = append(b, be.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(be.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, be.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, be.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, be.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/bem/bem.go b/bem/bem.go
index 13e5dfce..4af43688 100644
--- a/bem/bem.go
+++ b/bem/bem.go
@@ -167,3 +167,85 @@ func (bem *bem) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bem'
+// 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 (bem *bem) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bem.currencies[currency]
+ l := len(s) + len(bem.decimal) + len(bem.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(bem.decimal) - 1; j >= 0; j-- {
+ b = append(b, bem.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(bem.group) - 1; j >= 0; j-- {
+ b = append(b, bem.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(bem.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, bem.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bem.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, bem.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/bem_ZM/bem_ZM.go b/bem_ZM/bem_ZM.go
index 8a94402b..f5993aca 100644
--- a/bem_ZM/bem_ZM.go
+++ b/bem_ZM/bem_ZM.go
@@ -167,3 +167,85 @@ func (bem *bem_ZM) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bem_ZM'
+// 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 (bem *bem_ZM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bem.currencies[currency]
+ l := len(s) + len(bem.decimal) + len(bem.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(bem.decimal) - 1; j >= 0; j-- {
+ b = append(b, bem.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(bem.group) - 1; j >= 0; j-- {
+ b = append(b, bem.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(bem.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, bem.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bem.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, bem.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/bez/bez.go b/bez/bez.go
index 5f9ac654..288e088b 100644
--- a/bez/bez.go
+++ b/bez/bez.go
@@ -161,3 +161,79 @@ func (bez *bez) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bez'
+// 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 (bez *bez) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bez.currencies[currency]
+ l := len(s) + len(bez.decimal) + len(bez.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(bez.decimal) - 1; j >= 0; j-- {
+ b = append(b, bez.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(bez.group) - 1; j >= 0; j-- {
+ b = append(b, bez.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(bez.minus) - 1; j >= 0; j-- {
+ b = append(b, bez.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bez.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/bez_TZ/bez_TZ.go b/bez_TZ/bez_TZ.go
index 7e479b44..46cb7aa3 100644
--- a/bez_TZ/bez_TZ.go
+++ b/bez_TZ/bez_TZ.go
@@ -161,3 +161,79 @@ func (bez *bez_TZ) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bez_TZ'
+// 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 (bez *bez_TZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bez.currencies[currency]
+ l := len(s) + len(bez.decimal) + len(bez.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(bez.decimal) - 1; j >= 0; j-- {
+ b = append(b, bez.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(bez.group) - 1; j >= 0; j-- {
+ b = append(b, bez.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(bez.minus) - 1; j >= 0; j-- {
+ b = append(b, bez.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bez.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/bg/bg.go b/bg/bg.go
index 9917d76b..29c6e6ed 100644
--- a/bg/bg.go
+++ b/bg/bg.go
@@ -227,3 +227,80 @@ func (bg *bg) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bg'
+// 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 (bg *bg) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bg.currencies[currency]
+ l := len(s) + len(bg.decimal) + len(bg.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, bg.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(bg.group) - 1; j >= 0; j-- {
+ b = append(b, bg.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(bg.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, bg.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bg.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, bg.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, bg.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/bg_BG/bg_BG.go b/bg_BG/bg_BG.go
index 81f4b067..f95be601 100644
--- a/bg_BG/bg_BG.go
+++ b/bg_BG/bg_BG.go
@@ -227,3 +227,80 @@ func (bg *bg_BG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bg_BG'
+// 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 (bg *bg_BG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bg.currencies[currency]
+ l := len(s) + len(bg.decimal) + len(bg.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, bg.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(bg.group) - 1; j >= 0; j-- {
+ b = append(b, bg.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(bg.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, bg.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bg.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, bg.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, bg.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/bm/bm.go b/bm/bm.go
index d42cb167..36024a73 100644
--- a/bm/bm.go
+++ b/bm/bm.go
@@ -160,3 +160,85 @@ func (bm *bm) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bm'
+// 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 (bm *bm) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bm.currencies[currency]
+ l := len(s) + len(bm.decimal) + len(bm.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(bm.decimal) - 1; j >= 0; j-- {
+ b = append(b, bm.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(bm.group) - 1; j >= 0; j-- {
+ b = append(b, bm.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(bm.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, bm.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bm.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, bm.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/bm_ML/bm_ML.go b/bm_ML/bm_ML.go
index 7c5c35f3..50eeff58 100644
--- a/bm_ML/bm_ML.go
+++ b/bm_ML/bm_ML.go
@@ -160,3 +160,85 @@ func (bm *bm_ML) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bm_ML'
+// 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 (bm *bm_ML) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bm.currencies[currency]
+ l := len(s) + len(bm.decimal) + len(bm.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(bm.decimal) - 1; j >= 0; j-- {
+ b = append(b, bm.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(bm.group) - 1; j >= 0; j-- {
+ b = append(b, bm.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(bm.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, bm.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bm.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, bm.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/bn/bn.go b/bn/bn.go
index fd041d68..a585c1cd 100644
--- a/bn/bn.go
+++ b/bn/bn.go
@@ -281,3 +281,90 @@ func (bn *bn) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bn'
+// 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 (bn *bn) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bn.currencies[currency]
+ l := len(s) + len(bn.decimal) + len(bn.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(bn.decimal) - 1; j >= 0; j-- {
+ b = append(b, bn.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ for j := len(bn.group) - 1; j >= 0; j-- {
+ b = append(b, bn.group[j])
+ }
+
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(bn.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, bn.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bn.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, bn.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/bn_BD/bn_BD.go b/bn_BD/bn_BD.go
index b9900755..f78487ab 100644
--- a/bn_BD/bn_BD.go
+++ b/bn_BD/bn_BD.go
@@ -281,3 +281,90 @@ func (bn *bn_BD) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bn_BD'
+// 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 (bn *bn_BD) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bn.currencies[currency]
+ l := len(s) + len(bn.decimal) + len(bn.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(bn.decimal) - 1; j >= 0; j-- {
+ b = append(b, bn.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ for j := len(bn.group) - 1; j >= 0; j-- {
+ b = append(b, bn.group[j])
+ }
+
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(bn.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, bn.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bn.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, bn.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/bn_IN/bn_IN.go b/bn_IN/bn_IN.go
index 8519dd28..95c79ae9 100644
--- a/bn_IN/bn_IN.go
+++ b/bn_IN/bn_IN.go
@@ -281,3 +281,90 @@ func (bn *bn_IN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bn_IN'
+// 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 (bn *bn_IN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bn.currencies[currency]
+ l := len(s) + len(bn.decimal) + len(bn.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(bn.decimal) - 1; j >= 0; j-- {
+ b = append(b, bn.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ for j := len(bn.group) - 1; j >= 0; j-- {
+ b = append(b, bn.group[j])
+ }
+
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(bn.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, bn.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bn.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, bn.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/bo/bo.go b/bo/bo.go
index 3c0eb1a9..11b1bb7f 100644
--- a/bo/bo.go
+++ b/bo/bo.go
@@ -222,3 +222,81 @@ func (bo *bo) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bo'
+// 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 (bo *bo) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bo.currencies[currency]
+ l := len(s) + len(bo.decimal) + len(bo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, bo.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, bo.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(bo.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, bo.currencyNegativePrefix[j])
+ }
+
+ for j := len(bo.minus) - 1; j >= 0; j-- {
+ b = append(b, bo.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(bo.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, bo.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/bo_CN/bo_CN.go b/bo_CN/bo_CN.go
index f7a94a4d..9656e38f 100644
--- a/bo_CN/bo_CN.go
+++ b/bo_CN/bo_CN.go
@@ -222,3 +222,81 @@ func (bo *bo_CN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bo_CN'
+// 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 (bo *bo_CN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bo.currencies[currency]
+ l := len(s) + len(bo.decimal) + len(bo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, bo.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, bo.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(bo.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, bo.currencyNegativePrefix[j])
+ }
+
+ for j := len(bo.minus) - 1; j >= 0; j-- {
+ b = append(b, bo.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(bo.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, bo.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/bo_IN/bo_IN.go b/bo_IN/bo_IN.go
index 89d8aed4..6be5e521 100644
--- a/bo_IN/bo_IN.go
+++ b/bo_IN/bo_IN.go
@@ -222,3 +222,81 @@ func (bo *bo_IN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bo_IN'
+// 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 (bo *bo_IN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bo.currencies[currency]
+ l := len(s) + len(bo.decimal) + len(bo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, bo.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, bo.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(bo.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, bo.currencyNegativePrefix[j])
+ }
+
+ for j := len(bo.minus) - 1; j >= 0; j-- {
+ b = append(b, bo.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(bo.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, bo.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/br/br.go b/br/br.go
index 3eb2a120..23caf286 100644
--- a/br/br.go
+++ b/br/br.go
@@ -253,3 +253,83 @@ func (br *br) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'br'
+// 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 (br *br) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := br.currencies[currency]
+ l := len(s) + len(br.decimal) + len(br.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(br.decimal) - 1; j >= 0; j-- {
+ b = append(b, br.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(br.group) - 1; j >= 0; j-- {
+ b = append(b, br.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(br.minus) - 1; j >= 0; j-- {
+ b = append(b, br.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, br.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, br.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, br.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/br_FR/br_FR.go b/br_FR/br_FR.go
index 032e058e..a55a844c 100644
--- a/br_FR/br_FR.go
+++ b/br_FR/br_FR.go
@@ -253,3 +253,83 @@ func (br *br_FR) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'br_FR'
+// 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 (br *br_FR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := br.currencies[currency]
+ l := len(s) + len(br.decimal) + len(br.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(br.decimal) - 1; j >= 0; j-- {
+ b = append(b, br.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(br.group) - 1; j >= 0; j-- {
+ b = append(b, br.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(br.minus) - 1; j >= 0; j-- {
+ b = append(b, br.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, br.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, br.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, br.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/brx/brx.go b/brx/brx.go
index b8a294c1..ecde57d6 100644
--- a/brx/brx.go
+++ b/brx/brx.go
@@ -241,3 +241,88 @@ func (brx *brx) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'brx'
+// 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 (brx *brx) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := brx.currencies[currency]
+ l := len(s) + len(brx.decimal) + len(brx.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, brx.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ b = append(b, brx.group[0])
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(brx.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, brx.currencyNegativePrefix[j])
+ }
+
+ b = append(b, brx.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(brx.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, brx.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, brx.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/brx_IN/brx_IN.go b/brx_IN/brx_IN.go
index 7d93e6d8..baecc5a4 100644
--- a/brx_IN/brx_IN.go
+++ b/brx_IN/brx_IN.go
@@ -241,3 +241,88 @@ func (brx *brx_IN) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'brx_IN'
+// 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 (brx *brx_IN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := brx.currencies[currency]
+ l := len(s) + len(brx.decimal) + len(brx.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, brx.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ b = append(b, brx.group[0])
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(brx.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, brx.currencyNegativePrefix[j])
+ }
+
+ b = append(b, brx.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(brx.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, brx.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, brx.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/bs/bs.go b/bs/bs.go
index 3f982185..e84146d3 100644
--- a/bs/bs.go
+++ b/bs/bs.go
@@ -250,3 +250,75 @@ func (bs *bs) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bs'
+// 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 (bs *bs) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bs.currencies[currency]
+ l := len(s) + len(bs.decimal) + len(bs.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, bs.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, bs.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, bs.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bs.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, bs.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, bs.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/bs_Cyrl/bs_Cyrl.go b/bs_Cyrl/bs_Cyrl.go
index ff1d6e27..a3ebc7d8 100644
--- a/bs_Cyrl/bs_Cyrl.go
+++ b/bs_Cyrl/bs_Cyrl.go
@@ -250,3 +250,75 @@ func (bs *bs_Cyrl) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bs_Cyrl'
+// 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 (bs *bs_Cyrl) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bs.currencies[currency]
+ l := len(s) + len(bs.decimal) + len(bs.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, bs.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, bs.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, bs.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bs.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, bs.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, bs.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/bs_Cyrl_BA/bs_Cyrl_BA.go b/bs_Cyrl_BA/bs_Cyrl_BA.go
index 999afb17..aa49c30a 100644
--- a/bs_Cyrl_BA/bs_Cyrl_BA.go
+++ b/bs_Cyrl_BA/bs_Cyrl_BA.go
@@ -250,3 +250,75 @@ func (bs *bs_Cyrl_BA) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bs_Cyrl_BA'
+// 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 (bs *bs_Cyrl_BA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bs.currencies[currency]
+ l := len(s) + len(bs.decimal) + len(bs.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, bs.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, bs.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, bs.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bs.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, bs.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, bs.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/bs_Latn/bs_Latn.go b/bs_Latn/bs_Latn.go
index 547fe793..d38a42c2 100644
--- a/bs_Latn/bs_Latn.go
+++ b/bs_Latn/bs_Latn.go
@@ -250,3 +250,75 @@ func (bs *bs_Latn) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bs_Latn'
+// 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 (bs *bs_Latn) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bs.currencies[currency]
+ l := len(s) + len(bs.decimal) + len(bs.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, bs.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, bs.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, bs.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bs.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, bs.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, bs.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/bs_Latn_BA/bs_Latn_BA.go b/bs_Latn_BA/bs_Latn_BA.go
index e494bf67..f9a8d602 100644
--- a/bs_Latn_BA/bs_Latn_BA.go
+++ b/bs_Latn_BA/bs_Latn_BA.go
@@ -67,8 +67,8 @@ func (bs *bs_Latn_BA) CardinalPluralRule(num float64, v uint64) locales.PluralRu
f := locales.F(n, v)
iMod10 := i % 10
iMod100 := i % 100
- fMod100 := f % 100
fMod10 := f % 10
+ fMod100 := f % 100
if (v == 0 && iMod10 == 1 && iMod100 != 11) || (fMod10 == 1 && fMod100 != 11) {
return locales.PluralRuleOne
@@ -250,3 +250,75 @@ func (bs *bs_Latn_BA) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'bs_Latn_BA'
+// 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 (bs *bs_Latn_BA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := bs.currencies[currency]
+ l := len(s) + len(bs.decimal) + len(bs.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, bs.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, bs.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, bs.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, bs.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, bs.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, bs.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ca/ca.go b/ca/ca.go
index f0e88332..d4ae329c 100644
--- a/ca/ca.go
+++ b/ca/ca.go
@@ -233,3 +233,77 @@ func (ca *ca) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ca'
+// 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 (ca *ca) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ca.currencies[currency]
+ l := len(s) + len(ca.decimal) + len(ca.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ca.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ca.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ca.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ca.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ca.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ca.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ca.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ca_AD/ca_AD.go b/ca_AD/ca_AD.go
index 4798b5b0..93af9cfb 100644
--- a/ca_AD/ca_AD.go
+++ b/ca_AD/ca_AD.go
@@ -233,3 +233,77 @@ func (ca *ca_AD) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ca_AD'
+// 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 (ca *ca_AD) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ca.currencies[currency]
+ l := len(s) + len(ca.decimal) + len(ca.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ca.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ca.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ca.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ca.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ca.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ca.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ca.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ca_ES/ca_ES.go b/ca_ES/ca_ES.go
index d38af3e5..58e6d6af 100644
--- a/ca_ES/ca_ES.go
+++ b/ca_ES/ca_ES.go
@@ -233,3 +233,77 @@ func (ca *ca_ES) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ca_ES'
+// 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 (ca *ca_ES) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ca.currencies[currency]
+ l := len(s) + len(ca.decimal) + len(ca.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ca.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ca.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ca.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ca.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ca.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ca.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ca.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ca_ES_VALENCIA/ca_ES_VALENCIA.go b/ca_ES_VALENCIA/ca_ES_VALENCIA.go
index 0711b622..6e401777 100644
--- a/ca_ES_VALENCIA/ca_ES_VALENCIA.go
+++ b/ca_ES_VALENCIA/ca_ES_VALENCIA.go
@@ -233,3 +233,77 @@ func (ca *ca_ES_VALENCIA) FmtCurrency(num float64, v uint64, currency currency.T
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ca_ES_VALENCIA'
+// 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 (ca *ca_ES_VALENCIA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ca.currencies[currency]
+ l := len(s) + len(ca.decimal) + len(ca.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ca.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ca.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ca.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ca.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ca.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ca.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ca.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ca_FR/ca_FR.go b/ca_FR/ca_FR.go
index e2416066..babfe0dd 100644
--- a/ca_FR/ca_FR.go
+++ b/ca_FR/ca_FR.go
@@ -233,3 +233,77 @@ func (ca *ca_FR) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ca_FR'
+// 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 (ca *ca_FR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ca.currencies[currency]
+ l := len(s) + len(ca.decimal) + len(ca.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ca.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ca.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ca.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ca.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ca.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ca.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ca.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ca_IT/ca_IT.go b/ca_IT/ca_IT.go
index d308bcd4..6d544803 100644
--- a/ca_IT/ca_IT.go
+++ b/ca_IT/ca_IT.go
@@ -233,3 +233,77 @@ func (ca *ca_IT) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ca_IT'
+// 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 (ca *ca_IT) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ca.currencies[currency]
+ l := len(s) + len(ca.decimal) + len(ca.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ca.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ca.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ca.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ca.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ca.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ca.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ca.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ce/ce.go b/ce/ce.go
index fd411105..f4beece1 100644
--- a/ce/ce.go
+++ b/ce/ce.go
@@ -223,3 +223,75 @@ func (ce *ce) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ce'
+// 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 (ce *ce) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ce.currencies[currency]
+ l := len(s) + len(ce.decimal) + len(ce.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ce.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ce.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, ce.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ce.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ce.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ce.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ce_RU/ce_RU.go b/ce_RU/ce_RU.go
index f235cb13..dcb239ed 100644
--- a/ce_RU/ce_RU.go
+++ b/ce_RU/ce_RU.go
@@ -223,3 +223,75 @@ func (ce *ce_RU) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ce_RU'
+// 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 (ce *ce_RU) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ce.currencies[currency]
+ l := len(s) + len(ce.decimal) + len(ce.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ce.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ce.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, ce.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ce.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ce.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ce.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/cgg/cgg.go b/cgg/cgg.go
index f59ea782..308c2723 100644
--- a/cgg/cgg.go
+++ b/cgg/cgg.go
@@ -163,3 +163,79 @@ func (cgg *cgg) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'cgg'
+// 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 (cgg *cgg) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := cgg.currencies[currency]
+ l := len(s) + len(cgg.decimal) + len(cgg.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(cgg.decimal) - 1; j >= 0; j-- {
+ b = append(b, cgg.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(cgg.group) - 1; j >= 0; j-- {
+ b = append(b, cgg.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(cgg.minus) - 1; j >= 0; j-- {
+ b = append(b, cgg.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, cgg.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/cgg_UG/cgg_UG.go b/cgg_UG/cgg_UG.go
index 60eaa7a6..f4ec8dda 100644
--- a/cgg_UG/cgg_UG.go
+++ b/cgg_UG/cgg_UG.go
@@ -163,3 +163,79 @@ func (cgg *cgg_UG) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'cgg_UG'
+// 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 (cgg *cgg_UG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := cgg.currencies[currency]
+ l := len(s) + len(cgg.decimal) + len(cgg.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(cgg.decimal) - 1; j >= 0; j-- {
+ b = append(b, cgg.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(cgg.group) - 1; j >= 0; j-- {
+ b = append(b, cgg.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(cgg.minus) - 1; j >= 0; j-- {
+ b = append(b, cgg.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, cgg.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/chr/chr.go b/chr/chr.go
index b782fe5f..da881b73 100644
--- a/chr/chr.go
+++ b/chr/chr.go
@@ -219,3 +219,79 @@ func (chr *chr) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'chr'
+// 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 (chr *chr) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := chr.currencies[currency]
+ l := len(s) + len(chr.decimal) + len(chr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, chr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, chr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(chr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, chr.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, chr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, chr.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/chr_US/chr_US.go b/chr_US/chr_US.go
index f7dad424..05ba4e52 100644
--- a/chr_US/chr_US.go
+++ b/chr_US/chr_US.go
@@ -219,3 +219,79 @@ func (chr *chr_US) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'chr_US'
+// 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 (chr *chr_US) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := chr.currencies[currency]
+ l := len(s) + len(chr.decimal) + len(chr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, chr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, chr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(chr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, chr.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, chr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, chr.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ckb/ckb.go b/ckb/ckb.go
index 91cdd764..6d644f2a 100644
--- a/ckb/ckb.go
+++ b/ckb/ckb.go
@@ -37,7 +37,7 @@ func New() locales.Translator {
minus: []byte{0xe2, 0x80, 0x8e, 0x2d},
percent: []byte{0xd9, 0xaa},
perMille: []byte{},
- currencies: [][]uint8{[]uint8{0x41, 0x44, 0x50}, []uint8{0x41, 0x45, 0x44}, []uint8{0x41, 0x46, 0x41}, []uint8{0x41, 0x46, 0x4e}, []uint8{0x41, 0x4c, 0x4b}, []uint8{0x41, 0x4c, 0x4c}, []uint8{0x41, 0x4d, 0x44}, []uint8{0x41, 0x4e, 0x47}, []uint8{0x41, 0x4f, 0x41}, []uint8{0x41, 0x4f, 0x4b}, []uint8{0x41, 0x4f, 0x4e}, []uint8{0x41, 0x4f, 0x52}, []uint8{0x41, 0x52, 0x41}, []uint8{0x41, 0x52, 0x4c}, []uint8{0x41, 0x52, 0x4d}, []uint8{0x41, 0x52, 0x50}, []uint8{0x41, 0x52, 0x53}, []uint8{0x41, 0x54, 0x53}, []uint8{0x41, 0x55, 0x44}, []uint8{0x41, 0x57, 0x47}, []uint8{0x41, 0x5a, 0x4d}, []uint8{0x41, 0x5a, 0x4e}, []uint8{0x42, 0x41, 0x44}, []uint8{0x42, 0x41, 0x4d}, []uint8{0x42, 0x41, 0x4e}, []uint8{0x42, 0x42, 0x44}, []uint8{0x42, 0x44, 0x54}, []uint8{0x42, 0x45, 0x43}, []uint8{0x42, 0x45, 0x46}, []uint8{0x42, 0x45, 0x4c}, []uint8{0x42, 0x47, 0x4c}, []uint8{0x42, 0x47, 0x4d}, []uint8{0x42, 0x47, 0x4e}, []uint8{0x42, 0x47, 0x4f}, []uint8{0x42, 0x48, 0x44}, []uint8{0x42, 0x49, 0x46}, []uint8{0x42, 0x4d, 0x44}, []uint8{0x42, 0x4e, 0x44}, []uint8{0x42, 0x4f, 0x42}, []uint8{0x42, 0x4f, 0x4c}, []uint8{0x42, 0x4f, 0x50}, []uint8{0x42, 0x4f, 0x56}, []uint8{0x42, 0x52, 0x42}, []uint8{0x42, 0x52, 0x43}, []uint8{0x42, 0x52, 0x45}, []uint8{0x42, 0x52, 0x4c}, []uint8{0x42, 0x52, 0x4e}, []uint8{0x42, 0x52, 0x52}, []uint8{0x42, 0x52, 0x5a}, []uint8{0x42, 0x53, 0x44}, []uint8{0x42, 0x54, 0x4e}, []uint8{0x42, 0x55, 0x4b}, []uint8{0x42, 0x57, 0x50}, []uint8{0x42, 0x59, 0x42}, []uint8{0x42, 0x59, 0x52}, []uint8{0x42, 0x5a, 0x44}, []uint8{0x43, 0x41, 0x44}, []uint8{0x43, 0x44, 0x46}, []uint8{0x43, 0x48, 0x45}, []uint8{0x43, 0x48, 0x46}, []uint8{0x43, 0x48, 0x57}, []uint8{0x43, 0x4c, 0x45}, []uint8{0x43, 0x4c, 0x46}, []uint8{0x43, 0x4c, 0x50}, []uint8{0x43, 0x4e, 0x58}, []uint8{0x43, 0x4e, 0x59}, []uint8{0x43, 0x4f, 0x50}, []uint8{0x43, 0x4f, 0x55}, []uint8{0x43, 0x52, 0x43}, []uint8{0x43, 0x53, 0x44}, []uint8{0x43, 0x53, 0x4b}, []uint8{0x43, 0x55, 0x43}, []uint8{0x43, 0x55, 0x50}, []uint8{0x43, 0x56, 0x45}, []uint8{0x43, 0x59, 0x50}, []uint8{0x43, 0x5a, 0x4b}, []uint8{0x44, 0x44, 0x4d}, []uint8{0x44, 0x45, 0x4d}, []uint8{0x44, 0x4a, 0x46}, []uint8{0x44, 0x4b, 0x4b}, []uint8{0x44, 0x4f, 0x50}, []uint8{0x44, 0x5a, 0x44}, []uint8{0x45, 0x43, 0x53}, []uint8{0x45, 0x43, 0x56}, []uint8{0x45, 0x45, 0x4b}, []uint8{0x45, 0x47, 0x50}, []uint8{0x45, 0x52, 0x4e}, []uint8{0x45, 0x53, 0x41}, []uint8{0x45, 0x53, 0x42}, []uint8{0x45, 0x53, 0x50}, []uint8{0x45, 0x54, 0x42}, []uint8{0x45, 0x55, 0x52}, []uint8{0x46, 0x49, 0x4d}, []uint8{0x46, 0x4a, 0x44}, []uint8{0x46, 0x4b, 0x50}, []uint8{0x46, 0x52, 0x46}, []uint8{0x47, 0x42, 0x50}, []uint8{0x47, 0x45, 0x4b}, []uint8{0x47, 0x45, 0x4c}, []uint8{0x47, 0x48, 0x43}, []uint8{0x47, 0x48, 0x53}, []uint8{0x47, 0x49, 0x50}, []uint8{0x47, 0x4d, 0x44}, []uint8{0x47, 0x4e, 0x46}, []uint8{0x47, 0x4e, 0x53}, []uint8{0x47, 0x51, 0x45}, []uint8{0x47, 0x52, 0x44}, []uint8{0x47, 0x54, 0x51}, []uint8{0x47, 0x57, 0x45}, []uint8{0x47, 0x57, 0x50}, []uint8{0x47, 0x59, 0x44}, []uint8{0x48, 0x4b, 0x44}, []uint8{0x48, 0x4e, 0x4c}, []uint8{0x48, 0x52, 0x44}, []uint8{0x48, 0x52, 0x4b}, []uint8{0x48, 0x54, 0x47}, []uint8{0x48, 0x55, 0x46}, []uint8{0x49, 0x44, 0x52}, []uint8{0x49, 0x45, 0x50}, []uint8{0x49, 0x4c, 0x50}, []uint8{0x49, 0x4c, 0x52}, []uint8{0x49, 0x4c, 0x53}, []uint8{0x49, 0x4e, 0x52}, []uint8{0x49, 0x51, 0x44}, []uint8{0x49, 0x52, 0x52}, []uint8{0x49, 0x53, 0x4a}, []uint8{0x49, 0x53, 0x4b}, []uint8{0x49, 0x54, 0x4c}, []uint8{0x4a, 0x4d, 0x44}, []uint8{0x4a, 0x4f, 0x44}, []uint8{0x4a, 0x50, 0x59}, []uint8{0x4b, 0x45, 0x53}, []uint8{0x4b, 0x47, 0x53}, []uint8{0x4b, 0x48, 0x52}, []uint8{0x4b, 0x4d, 0x46}, []uint8{0x4b, 0x50, 0x57}, []uint8{0x4b, 0x52, 0x48}, []uint8{0x4b, 0x52, 0x4f}, []uint8{0x4b, 0x52, 0x57}, []uint8{0x4b, 0x57, 0x44}, []uint8{0x4b, 0x59, 0x44}, []uint8{0x4b, 0x5a, 0x54}, []uint8{0x4c, 0x41, 0x4b}, []uint8{0x4c, 0x42, 0x50}, []uint8{0x4c, 0x4b, 0x52}, []uint8{0x4c, 0x52, 0x44}, []uint8{0x4c, 0x53, 0x4c}, []uint8{0x4c, 0x54, 0x4c}, []uint8{0x4c, 0x54, 0x54}, []uint8{0x4c, 0x55, 0x43}, []uint8{0x4c, 0x55, 0x46}, []uint8{0x4c, 0x55, 0x4c}, []uint8{0x4c, 0x56, 0x4c}, []uint8{0x4c, 0x56, 0x52}, []uint8{0x4c, 0x59, 0x44}, []uint8{0x4d, 0x41, 0x44}, []uint8{0x4d, 0x41, 0x46}, []uint8{0x4d, 0x43, 0x46}, []uint8{0x4d, 0x44, 0x43}, []uint8{0x4d, 0x44, 0x4c}, []uint8{0x4d, 0x47, 0x41}, []uint8{0x4d, 0x47, 0x46}, []uint8{0x4d, 0x4b, 0x44}, []uint8{0x4d, 0x4b, 0x4e}, []uint8{0x4d, 0x4c, 0x46}, []uint8{0x4d, 0x4d, 0x4b}, []uint8{0x4d, 0x4e, 0x54}, []uint8{0x4d, 0x4f, 0x50}, []uint8{0x4d, 0x52, 0x4f}, []uint8{0x4d, 0x54, 0x4c}, []uint8{0x4d, 0x54, 0x50}, []uint8{0x4d, 0x55, 0x52}, []uint8{0x4d, 0x56, 0x50}, []uint8{0x4d, 0x56, 0x52}, []uint8{0x4d, 0x57, 0x4b}, []uint8{0x4d, 0x58, 0x4e}, []uint8{0x4d, 0x58, 0x50}, []uint8{0x4d, 0x58, 0x56}, []uint8{0x4d, 0x59, 0x52}, []uint8{0x4d, 0x5a, 0x45}, []uint8{0x4d, 0x5a, 0x4d}, []uint8{0x4d, 0x5a, 0x4e}, []uint8{0x4e, 0x41, 0x44}, []uint8{0x4e, 0x47, 0x4e}, []uint8{0x4e, 0x49, 0x43}, []uint8{0x4e, 0x49, 0x4f}, []uint8{0x4e, 0x4c, 0x47}, []uint8{0x4e, 0x4f, 0x4b}, []uint8{0x4e, 0x50, 0x52}, []uint8{0x4e, 0x5a, 0x44}, []uint8{0x4f, 0x4d, 0x52}, []uint8{0x50, 0x41, 0x42}, []uint8{0x50, 0x45, 0x49}, []uint8{0x50, 0x45, 0x4e}, []uint8{0x50, 0x45, 0x53}, []uint8{0x50, 0x47, 0x4b}, []uint8{0x50, 0x48, 0x50}, []uint8{0x50, 0x4b, 0x52}, []uint8{0x50, 0x4c, 0x4e}, []uint8{0x50, 0x4c, 0x5a}, []uint8{0x50, 0x54, 0x45}, []uint8{0x50, 0x59, 0x47}, []uint8{0x51, 0x41, 0x52}, []uint8{0x52, 0x48, 0x44}, []uint8{0x52, 0x4f, 0x4c}, []uint8{0x52, 0x4f, 0x4e}, []uint8{0x52, 0x53, 0x44}, []uint8{0x52, 0x55, 0x42}, []uint8{0x52, 0x55, 0x52}, []uint8{0x52, 0x57, 0x46}, []uint8{0x53, 0x41, 0x52}, []uint8{0x53, 0x42, 0x44}, []uint8{0x53, 0x43, 0x52}, []uint8{0x53, 0x44, 0x44}, []uint8{0x53, 0x44, 0x47}, []uint8{0x53, 0x44, 0x50}, []uint8{0x53, 0x45, 0x4b}, []uint8{0x53, 0x47, 0x44}, []uint8{0x53, 0x48, 0x50}, []uint8{0x53, 0x49, 0x54}, []uint8{0x53, 0x4b, 0x4b}, []uint8{0x53, 0x4c, 0x4c}, []uint8{0x53, 0x4f, 0x53}, []uint8{0x53, 0x52, 0x44}, []uint8{0x53, 0x52, 0x47}, []uint8{0x53, 0x53, 0x50}, []uint8{0x53, 0x54, 0x44}, []uint8{0x53, 0x55, 0x52}, []uint8{0x53, 0x56, 0x43}, []uint8{0x53, 0x59, 0x50}, []uint8{0x53, 0x5a, 0x4c}, []uint8{0x54, 0x48, 0x42}, []uint8{0x54, 0x4a, 0x52}, []uint8{0x54, 0x4a, 0x53}, []uint8{0x54, 0x4d, 0x4d}, []uint8{0x54, 0x4d, 0x54}, []uint8{0x54, 0x4e, 0x44}, []uint8{0x54, 0x4f, 0x50}, []uint8{0x54, 0x50, 0x45}, []uint8{0x54, 0x52, 0x4c}, []uint8{0x54, 0x52, 0x59}, []uint8{0x54, 0x54, 0x44}, []uint8{0x54, 0x57, 0x44}, []uint8{0x54, 0x5a, 0x53}, []uint8{0x55, 0x41, 0x48}, []uint8{0x55, 0x41, 0x4b}, []uint8{0x55, 0x47, 0x53}, []uint8{0x55, 0x47, 0x58}, []uint8{0x55, 0x53, 0x44}, []uint8{0x55, 0x53, 0x4e}, []uint8{0x55, 0x53, 0x53}, []uint8{0x55, 0x59, 0x49}, []uint8{0x55, 0x59, 0x50}, []uint8{0x55, 0x59, 0x55}, []uint8{0x55, 0x5a, 0x53}, []uint8{0x56, 0x45, 0x42}, []uint8{0x56, 0x45, 0x46}, []uint8{0x56, 0x4e, 0x44}, []uint8{0x56, 0x4e, 0x4e}, []uint8{0x56, 0x55, 0x56}, []uint8{0x57, 0x53, 0x54}, []uint8{0x58, 0x41, 0x46}, []uint8{0x58, 0x41, 0x47}, []uint8{0x58, 0x41, 0x55}, []uint8{0x58, 0x42, 0x41}, []uint8{0x58, 0x42, 0x42}, []uint8{0x58, 0x42, 0x43}, []uint8{0x58, 0x42, 0x44}, []uint8{0x58, 0x43, 0x44}, []uint8{0x58, 0x44, 0x52}, []uint8{0x58, 0x45, 0x55}, []uint8{0x58, 0x46, 0x4f}, []uint8{0x58, 0x46, 0x55}, []uint8{0x58, 0x4f, 0x46}, []uint8{0x58, 0x50, 0x44}, []uint8{0x58, 0x50, 0x46}, []uint8{0x58, 0x50, 0x54}, []uint8{0x58, 0x52, 0x45}, []uint8{0x58, 0x53, 0x55}, []uint8{0x58, 0x54, 0x53}, []uint8{0x58, 0x55, 0x41}, []uint8{0x58, 0x58, 0x58}, []uint8{0x59, 0x44, 0x44}, []uint8{0x59, 0x45, 0x52}, []uint8{0x59, 0x55, 0x44}, []uint8{0x59, 0x55, 0x4d}, []uint8{0x59, 0x55, 0x4e}, []uint8{0x59, 0x55, 0x52}, []uint8{0x5a, 0x41, 0x4c}, []uint8{0x5a, 0x41, 0x52}, []uint8{0x5a, 0x4d, 0x4b}, []uint8{0x5a, 0x4d, 0x57}, []uint8{0x5a, 0x52, 0x4e}, []uint8{0x5a, 0x52, 0x5a}, []uint8{0x5a, 0x57, 0x44}, []uint8{0x5a, 0x57, 0x4c}, []uint8{0x5a, 0x57, 0x52}}}
+ currencies: [][]uint8{{0x41, 0x44, 0x50}, {0x41, 0x45, 0x44}, {0x41, 0x46, 0x41}, {0x41, 0x46, 0x4e}, {0x41, 0x4c, 0x4b}, {0x41, 0x4c, 0x4c}, {0x41, 0x4d, 0x44}, {0x41, 0x4e, 0x47}, {0x41, 0x4f, 0x41}, {0x41, 0x4f, 0x4b}, {0x41, 0x4f, 0x4e}, {0x41, 0x4f, 0x52}, {0x41, 0x52, 0x41}, {0x41, 0x52, 0x4c}, {0x41, 0x52, 0x4d}, {0x41, 0x52, 0x50}, {0x41, 0x52, 0x53}, {0x41, 0x54, 0x53}, {0x41, 0x55, 0x44}, {0x41, 0x57, 0x47}, {0x41, 0x5a, 0x4d}, {0x41, 0x5a, 0x4e}, {0x42, 0x41, 0x44}, {0x42, 0x41, 0x4d}, {0x42, 0x41, 0x4e}, {0x42, 0x42, 0x44}, {0x42, 0x44, 0x54}, {0x42, 0x45, 0x43}, {0x42, 0x45, 0x46}, {0x42, 0x45, 0x4c}, {0x42, 0x47, 0x4c}, {0x42, 0x47, 0x4d}, {0x42, 0x47, 0x4e}, {0x42, 0x47, 0x4f}, {0x42, 0x48, 0x44}, {0x42, 0x49, 0x46}, {0x42, 0x4d, 0x44}, {0x42, 0x4e, 0x44}, {0x42, 0x4f, 0x42}, {0x42, 0x4f, 0x4c}, {0x42, 0x4f, 0x50}, {0x42, 0x4f, 0x56}, {0x42, 0x52, 0x42}, {0x42, 0x52, 0x43}, {0x42, 0x52, 0x45}, {0x42, 0x52, 0x4c}, {0x42, 0x52, 0x4e}, {0x42, 0x52, 0x52}, {0x42, 0x52, 0x5a}, {0x42, 0x53, 0x44}, {0x42, 0x54, 0x4e}, {0x42, 0x55, 0x4b}, {0x42, 0x57, 0x50}, {0x42, 0x59, 0x42}, {0x42, 0x59, 0x52}, {0x42, 0x5a, 0x44}, {0x43, 0x41, 0x44}, {0x43, 0x44, 0x46}, {0x43, 0x48, 0x45}, {0x43, 0x48, 0x46}, {0x43, 0x48, 0x57}, {0x43, 0x4c, 0x45}, {0x43, 0x4c, 0x46}, {0x43, 0x4c, 0x50}, {0x43, 0x4e, 0x58}, {0x43, 0x4e, 0x59}, {0x43, 0x4f, 0x50}, {0x43, 0x4f, 0x55}, {0x43, 0x52, 0x43}, {0x43, 0x53, 0x44}, {0x43, 0x53, 0x4b}, {0x43, 0x55, 0x43}, {0x43, 0x55, 0x50}, {0x43, 0x56, 0x45}, {0x43, 0x59, 0x50}, {0x43, 0x5a, 0x4b}, {0x44, 0x44, 0x4d}, {0x44, 0x45, 0x4d}, {0x44, 0x4a, 0x46}, {0x44, 0x4b, 0x4b}, {0x44, 0x4f, 0x50}, {0x44, 0x5a, 0x44}, {0x45, 0x43, 0x53}, {0x45, 0x43, 0x56}, {0x45, 0x45, 0x4b}, {0x45, 0x47, 0x50}, {0x45, 0x52, 0x4e}, {0x45, 0x53, 0x41}, {0x45, 0x53, 0x42}, {0x45, 0x53, 0x50}, {0x45, 0x54, 0x42}, {0x45, 0x55, 0x52}, {0x46, 0x49, 0x4d}, {0x46, 0x4a, 0x44}, {0x46, 0x4b, 0x50}, {0x46, 0x52, 0x46}, {0x47, 0x42, 0x50}, {0x47, 0x45, 0x4b}, {0x47, 0x45, 0x4c}, {0x47, 0x48, 0x43}, {0x47, 0x48, 0x53}, {0x47, 0x49, 0x50}, {0x47, 0x4d, 0x44}, {0x47, 0x4e, 0x46}, {0x47, 0x4e, 0x53}, {0x47, 0x51, 0x45}, {0x47, 0x52, 0x44}, {0x47, 0x54, 0x51}, {0x47, 0x57, 0x45}, {0x47, 0x57, 0x50}, {0x47, 0x59, 0x44}, {0x48, 0x4b, 0x44}, {0x48, 0x4e, 0x4c}, {0x48, 0x52, 0x44}, {0x48, 0x52, 0x4b}, {0x48, 0x54, 0x47}, {0x48, 0x55, 0x46}, {0x49, 0x44, 0x52}, {0x49, 0x45, 0x50}, {0x49, 0x4c, 0x50}, {0x49, 0x4c, 0x52}, {0x49, 0x4c, 0x53}, {0x49, 0x4e, 0x52}, {0x49, 0x51, 0x44}, {0x49, 0x52, 0x52}, {0x49, 0x53, 0x4a}, {0x49, 0x53, 0x4b}, {0x49, 0x54, 0x4c}, {0x4a, 0x4d, 0x44}, {0x4a, 0x4f, 0x44}, {0x4a, 0x50, 0x59}, {0x4b, 0x45, 0x53}, {0x4b, 0x47, 0x53}, {0x4b, 0x48, 0x52}, {0x4b, 0x4d, 0x46}, {0x4b, 0x50, 0x57}, {0x4b, 0x52, 0x48}, {0x4b, 0x52, 0x4f}, {0x4b, 0x52, 0x57}, {0x4b, 0x57, 0x44}, {0x4b, 0x59, 0x44}, {0x4b, 0x5a, 0x54}, {0x4c, 0x41, 0x4b}, {0x4c, 0x42, 0x50}, {0x4c, 0x4b, 0x52}, {0x4c, 0x52, 0x44}, {0x4c, 0x53, 0x4c}, {0x4c, 0x54, 0x4c}, {0x4c, 0x54, 0x54}, {0x4c, 0x55, 0x43}, {0x4c, 0x55, 0x46}, {0x4c, 0x55, 0x4c}, {0x4c, 0x56, 0x4c}, {0x4c, 0x56, 0x52}, {0x4c, 0x59, 0x44}, {0x4d, 0x41, 0x44}, {0x4d, 0x41, 0x46}, {0x4d, 0x43, 0x46}, {0x4d, 0x44, 0x43}, {0x4d, 0x44, 0x4c}, {0x4d, 0x47, 0x41}, {0x4d, 0x47, 0x46}, {0x4d, 0x4b, 0x44}, {0x4d, 0x4b, 0x4e}, {0x4d, 0x4c, 0x46}, {0x4d, 0x4d, 0x4b}, {0x4d, 0x4e, 0x54}, {0x4d, 0x4f, 0x50}, {0x4d, 0x52, 0x4f}, {0x4d, 0x54, 0x4c}, {0x4d, 0x54, 0x50}, {0x4d, 0x55, 0x52}, {0x4d, 0x56, 0x50}, {0x4d, 0x56, 0x52}, {0x4d, 0x57, 0x4b}, {0x4d, 0x58, 0x4e}, {0x4d, 0x58, 0x50}, {0x4d, 0x58, 0x56}, {0x4d, 0x59, 0x52}, {0x4d, 0x5a, 0x45}, {0x4d, 0x5a, 0x4d}, {0x4d, 0x5a, 0x4e}, {0x4e, 0x41, 0x44}, {0x4e, 0x47, 0x4e}, {0x4e, 0x49, 0x43}, {0x4e, 0x49, 0x4f}, {0x4e, 0x4c, 0x47}, {0x4e, 0x4f, 0x4b}, {0x4e, 0x50, 0x52}, {0x4e, 0x5a, 0x44}, {0x4f, 0x4d, 0x52}, {0x50, 0x41, 0x42}, {0x50, 0x45, 0x49}, {0x50, 0x45, 0x4e}, {0x50, 0x45, 0x53}, {0x50, 0x47, 0x4b}, {0x50, 0x48, 0x50}, {0x50, 0x4b, 0x52}, {0x50, 0x4c, 0x4e}, {0x50, 0x4c, 0x5a}, {0x50, 0x54, 0x45}, {0x50, 0x59, 0x47}, {0x51, 0x41, 0x52}, {0x52, 0x48, 0x44}, {0x52, 0x4f, 0x4c}, {0x52, 0x4f, 0x4e}, {0x52, 0x53, 0x44}, {0x52, 0x55, 0x42}, {0x52, 0x55, 0x52}, {0x52, 0x57, 0x46}, {0x53, 0x41, 0x52}, {0x53, 0x42, 0x44}, {0x53, 0x43, 0x52}, {0x53, 0x44, 0x44}, {0x53, 0x44, 0x47}, {0x53, 0x44, 0x50}, {0x53, 0x45, 0x4b}, {0x53, 0x47, 0x44}, {0x53, 0x48, 0x50}, {0x53, 0x49, 0x54}, {0x53, 0x4b, 0x4b}, {0x53, 0x4c, 0x4c}, {0x53, 0x4f, 0x53}, {0x53, 0x52, 0x44}, {0x53, 0x52, 0x47}, {0x53, 0x53, 0x50}, {0x53, 0x54, 0x44}, {0x53, 0x55, 0x52}, {0x53, 0x56, 0x43}, {0x53, 0x59, 0x50}, {0x53, 0x5a, 0x4c}, {0x54, 0x48, 0x42}, {0x54, 0x4a, 0x52}, {0x54, 0x4a, 0x53}, {0x54, 0x4d, 0x4d}, {0x54, 0x4d, 0x54}, {0x54, 0x4e, 0x44}, {0x54, 0x4f, 0x50}, {0x54, 0x50, 0x45}, {0x54, 0x52, 0x4c}, {0x54, 0x52, 0x59}, {0x54, 0x54, 0x44}, {0x54, 0x57, 0x44}, {0x54, 0x5a, 0x53}, {0x55, 0x41, 0x48}, {0x55, 0x41, 0x4b}, {0x55, 0x47, 0x53}, {0x55, 0x47, 0x58}, {0x55, 0x53, 0x44}, {0x55, 0x53, 0x4e}, {0x55, 0x53, 0x53}, {0x55, 0x59, 0x49}, {0x55, 0x59, 0x50}, {0x55, 0x59, 0x55}, {0x55, 0x5a, 0x53}, {0x56, 0x45, 0x42}, {0x56, 0x45, 0x46}, {0x56, 0x4e, 0x44}, {0x56, 0x4e, 0x4e}, {0x56, 0x55, 0x56}, {0x57, 0x53, 0x54}, {0x58, 0x41, 0x46}, {0x58, 0x41, 0x47}, {0x58, 0x41, 0x55}, {0x58, 0x42, 0x41}, {0x58, 0x42, 0x42}, {0x58, 0x42, 0x43}, {0x58, 0x42, 0x44}, {0x58, 0x43, 0x44}, {0x58, 0x44, 0x52}, {0x58, 0x45, 0x55}, {0x58, 0x46, 0x4f}, {0x58, 0x46, 0x55}, {0x58, 0x4f, 0x46}, {0x58, 0x50, 0x44}, {0x58, 0x50, 0x46}, {0x58, 0x50, 0x54}, {0x58, 0x52, 0x45}, {0x58, 0x53, 0x55}, {0x58, 0x54, 0x53}, {0x58, 0x55, 0x41}, {0x58, 0x58, 0x58}, {0x59, 0x44, 0x44}, {0x59, 0x45, 0x52}, {0x59, 0x55, 0x44}, {0x59, 0x55, 0x4d}, {0x59, 0x55, 0x4e}, {0x59, 0x55, 0x52}, {0x5a, 0x41, 0x4c}, {0x5a, 0x41, 0x52}, {0x5a, 0x4d, 0x4b}, {0x5a, 0x4d, 0x57}, {0x5a, 0x52, 0x4e}, {0x5a, 0x52, 0x5a}, {0x5a, 0x57, 0x44}, {0x5a, 0x57, 0x4c}, {0x5a, 0x57, 0x52}}}
}
// Locale returns the current translators string locale
@@ -103,5 +103,15 @@ func (ckb *ckb) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
symbol := ckb.currencies[currency]
- return []byte(s)
+ return append(append([]byte{}, symbol...), s...)
+}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ckb'
+// 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 (ckb *ckb) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ckb.currencies[currency]
+ return append(append([]byte{}, symbol...), s...)
}
diff --git a/ckb_IQ/ckb_IQ.go b/ckb_IQ/ckb_IQ.go
index 13c9e017..1136dc8a 100644
--- a/ckb_IQ/ckb_IQ.go
+++ b/ckb_IQ/ckb_IQ.go
@@ -103,5 +103,15 @@ func (ckb *ckb_IQ) FmtCurrency(num float64, v uint64, currency currency.Type) []
s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
symbol := ckb.currencies[currency]
- return []byte(s)
+ return append(append([]byte{}, symbol...), s...)
+}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ckb_IQ'
+// 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 (ckb *ckb_IQ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ckb.currencies[currency]
+ return append(append([]byte{}, symbol...), s...)
}
diff --git a/ckb_IR/ckb_IR.go b/ckb_IR/ckb_IR.go
index 56b22684..690c9959 100644
--- a/ckb_IR/ckb_IR.go
+++ b/ckb_IR/ckb_IR.go
@@ -103,5 +103,15 @@ func (ckb *ckb_IR) FmtCurrency(num float64, v uint64, currency currency.Type) []
s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
symbol := ckb.currencies[currency]
- return []byte(s)
+ return append(append([]byte{}, symbol...), s...)
+}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ckb_IR'
+// 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 (ckb *ckb_IR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ckb.currencies[currency]
+ return append(append([]byte{}, symbol...), s...)
}
diff --git a/cmd/generate_resources.go b/cmd/generate_resources.go
index 1e028a2a..b5ba050c 100644
--- a/cmd/generate_resources.go
+++ b/cmd/generate_resources.go
@@ -94,6 +94,7 @@ type translator struct {
FmtCurrencySuffix string
FmtCurrencyInPrefix bool
FmtCurrencyLeft bool
+ FmtCurrencyNegativeExists bool
FmtCurrencyNegativePrefix string
FmtCurrencyNegativeSuffix string
FmtCurrencyNegativeInPrefix bool
@@ -167,11 +168,6 @@ func main() {
fmt.Println("Writing Data:", trans.Locale)
- if trans.Locale == "en" {
- fmt.Println("\t", trans.CurrencyNumberFormat)
- fmt.Println("\t", trans.NegativeCurrencyNumberFormat)
- }
-
if err = os.MkdirAll(fmt.Sprintf(locDir, trans.Locale), 0777); err != nil {
log.Fatal(err)
}
@@ -585,6 +581,8 @@ func parseCurrencyNumberFormat(trans *translator) {
return
}
+ trans.FmtCurrencyNegativeExists = true
+
for idx = 0; idx < len(trans.NegativeCurrencyNumberFormat); idx++ {
if trans.NegativeCurrencyNumberFormat[idx] == '#' || trans.NegativeCurrencyNumberFormat[idx] == '0' {
diff --git a/cmd/translator.tmpl b/cmd/translator.tmpl
index f66a3ef4..b6bd0020 100644
--- a/cmd/translator.tmpl
+++ b/cmd/translator.tmpl
@@ -496,7 +496,202 @@ func({{ .BaseLocale }} *{{ .Locale }}) FmtCurrency(num float64, v uint64, curren
return b
{{ else }}
- return []byte(s)
+ return append(append([]byte{}, symbol...), s...)
+ {{ end -}}
+}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for '{{ .Locale }}'
+// 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({{ .BaseLocale }} *{{ .Locale }}) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := {{ .BaseLocale }}.currencies[currency]
+ {{- if eq .FmtCurrencyExists true }}
+ {{- if gt .FmtCurrencyGroupLen 0 }}
+ l := len(s) + len({{ .BaseLocale }}.decimal) + len({{ .BaseLocale }}.group) * len(s[:len(s)-int(v)-1]) / {{ .FmtCurrencyGroupLen }}
+ count := 0
+ inWhole := v == 0
+ {{- if gt .FmtCurrencySecondaryGroupLen 0}}
+ inSecondary := false
+ groupThreshold := {{ .FmtCurrencyGroupLen }}
+ {{ end -}}
+ {{ else }}
+ l := len(s) + len({{ .BaseLocale }}.decimal)
+ {{ end }}
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+
+ {{- if eq .DecimalLen 1 }}
+ b = append(b, {{ .BaseLocale }}.decimal[0])
+ {{- else }}
+ for j := len({{ .BaseLocale }}.decimal) - 1; j >= 0; j-- {
+ b = append(b, {{ .BaseLocale }}.decimal[j])
+ }
+ {{ end -}}
+ {{- if gt .FmtCurrencyGroupLen 0 }}
+ inWhole = true
+ {{ end }}
+ continue
+ }
+
+ {{ if gt .FmtCurrencyGroupLen 0 }}
+ if inWhole {
+
+ {{- if gt .FmtCurrencySecondaryGroupLen 0}}
+
+ if count == groupThreshold {
+ {{- if eq .GroupLen 1 }}
+ b = append(b, {{ .BaseLocale }}.group[0])
+ {{- else }}
+ for j := len({{ .BaseLocale }}.group) - 1; j >= 0; j-- {
+ b = append(b, {{ .BaseLocale }}.group[j])
+ }
+ {{ end }}
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = {{ .FmtCurrencySecondaryGroupLen }}
+ }
+ {{ else }}
+ if count == {{ .FmtCurrencyGroupLen }} {
+ {{- if eq .GroupLen 1 }}
+ b = append(b, {{ .BaseLocale }}.group[0])
+ {{- else }}
+ for j := len({{ .BaseLocale }}.group) - 1; j >= 0; j-- {
+ b = append(b, {{ .BaseLocale }}.group[j])
+ }
+ {{ end }}
+ count = 1
+ {{ end -}}
+ } else {
+ count++
+ }
+ }
+
+ {{ end }}
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ {{ if and .FmtCurrencyNegativeInPrefix (not .FmtCurrencyNegativeLeft) }}
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+ {{ end }}
+
+ {{ if gt (len .FmtCurrencyNegativePrefix) 0}}
+ {{- if eq (len .FmtCurrencyNegativePrefix) 1 }}
+ b = append(b, {{ .BaseLocale }}.currencyNegativePrefix[0])
+ {{ else }}
+ for j := len({{ .BaseLocale }}.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, {{ .BaseLocale }}.currencyNegativePrefix[j])
+ }
+ {{ end }}
+ {{ end }}
+
+ {{ if and .FmtCurrencyNegativeInPrefix .FmtCurrencyNegativeLeft }}
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+ {{ end }}
+
+ {{ if eq (not .FmtCurrencyNegativeExists) true}}
+ {{- if eq .MinusLen 1 }}
+ b = append(b, {{ .BaseLocale }}.minus[0])
+ {{ else }}
+ for j := len({{ .BaseLocale }}.minus) - 1; j >= 0; j-- {
+ b = append(b, {{ .BaseLocale }}.minus[j])
+ }
+ {{ end -}}
+ {{ end }}
+
+ {{ if or .FmtCurrencyInPrefix (gt (len .FmtCurrencyPrefix) 0) }}
+ } else {
+ {{ end }}
+
+ {{ if and .FmtCurrencyInPrefix (not .FmtCurrencyLeft) }}
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+ {{ end }}
+
+ {{ if gt (len .FmtCurrencyPrefix) 0}}
+ {{- if eq (len .FmtCurrencyPrefix) 1 }}
+ b = append(b, {{ .BaseLocale }}.currencyPositivePrefix[0])
+ {{ else }}
+ for j := len({{ .BaseLocale }}.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, {{ .BaseLocale }}.currencyPositivePrefix[j])
+ }
+ {{ end }}
+ {{ end }}
+
+ {{ if and .FmtCurrencyInPrefix .FmtCurrencyLeft }}
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+ {{ end }}
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ {{ if gt .FmtCurrencyMinDecimalLen 0 }}
+ if int(v) < {{ .FmtCurrencyMinDecimalLen }} {
+
+ if v == 0 {
+ b = append(b, {{ .BaseLocale }}.decimal...)
+ }
+
+ for i := 0; i < {{ .FmtCurrencyMinDecimalLen }}-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+ {{ end }}
+
+ {{ if or (not .FmtCurrencyNegativeInPrefix) (gt (len .FmtCurrencyNegativeSuffix) 0)}}
+ if num < 0 {
+ {{ end }}
+ {{ if and (not .FmtCurrencyNegativeInPrefix) .FmtCurrencyNegativeLeft }}
+ b = append(b, symbol...)
+ {{ end }}
+
+ {{ if gt (len .FmtCurrencyNegativeSuffix) 0}}
+ b = append(b, {{ .BaseLocale }}.currencyNegativeSuffix...)
+ {{ end }}
+
+ {{ if and (not .FmtCurrencyNegativeInPrefix) (not .FmtCurrencyNegativeLeft) }}
+ b = append(b, symbol...)
+ {{ end }}
+ {{ if or (not .FmtCurrencyInPrefix) (gt (len .FmtCurrencySuffix) 0)}}
+ } else {
+ {{ end }}
+ {{ if and (not .FmtCurrencyInPrefix) .FmtCurrencyLeft }}
+ b = append(b, symbol...)
+ {{ end }}
+
+ {{ if gt (len .FmtCurrencySuffix) 0}}
+ b = append(b, {{ .BaseLocale }}.currencyPositiveSuffix...)
+ {{ end }}
+
+ {{ if and (not .FmtCurrencyInPrefix) (not .FmtCurrencyLeft) }}
+ b = append(b, symbol...)
+ {{ end }}
+ {{ if or (not .FmtCurrencyNegativeInPrefix) (gt (len .FmtCurrencyNegativeSuffix) 0)}}
+ }
+ {{ end }}
+
+ return b
+ {{ else }}
+ return append(append([]byte{}, symbol...), s...)
{{ end -}}
}
diff --git a/cs/cs.go b/cs/cs.go
index 8dfd5931..f93ea565 100644
--- a/cs/cs.go
+++ b/cs/cs.go
@@ -282,3 +282,83 @@ func (cs *cs) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'cs'
+// 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 (cs *cs) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := cs.currencies[currency]
+ l := len(s) + len(cs.decimal) + len(cs.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(cs.decimal) - 1; j >= 0; j-- {
+ b = append(b, cs.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(cs.group) - 1; j >= 0; j-- {
+ b = append(b, cs.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(cs.minus) - 1; j >= 0; j-- {
+ b = append(b, cs.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, cs.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, cs.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, cs.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/cs_CZ/cs_CZ.go b/cs_CZ/cs_CZ.go
index bd3491bc..21ea930f 100644
--- a/cs_CZ/cs_CZ.go
+++ b/cs_CZ/cs_CZ.go
@@ -282,3 +282,83 @@ func (cs *cs_CZ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'cs_CZ'
+// 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 (cs *cs_CZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := cs.currencies[currency]
+ l := len(s) + len(cs.decimal) + len(cs.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(cs.decimal) - 1; j >= 0; j-- {
+ b = append(b, cs.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(cs.group) - 1; j >= 0; j-- {
+ b = append(b, cs.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(cs.minus) - 1; j >= 0; j-- {
+ b = append(b, cs.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, cs.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, cs.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, cs.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/cu/cu.go b/cu/cu.go
index 491d3525..2ca09ca6 100644
--- a/cu/cu.go
+++ b/cu/cu.go
@@ -222,3 +222,78 @@ func (cu *cu) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'cu'
+// 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 (cu *cu) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := cu.currencies[currency]
+ l := len(s) + len(cu.decimal) + len(cu.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, cu.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(cu.group) - 1; j >= 0; j-- {
+ b = append(b, cu.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, cu.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, cu.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, cu.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, cu.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/cu_RU/cu_RU.go b/cu_RU/cu_RU.go
index 2435b58c..5b961e91 100644
--- a/cu_RU/cu_RU.go
+++ b/cu_RU/cu_RU.go
@@ -222,3 +222,78 @@ func (cu *cu_RU) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'cu_RU'
+// 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 (cu *cu_RU) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := cu.currencies[currency]
+ l := len(s) + len(cu.decimal) + len(cu.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, cu.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(cu.group) - 1; j >= 0; j-- {
+ b = append(b, cu.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, cu.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, cu.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, cu.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, cu.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/cy/cy.go b/cy/cy.go
index 2a0bbacf..1b0635bb 100644
--- a/cy/cy.go
+++ b/cy/cy.go
@@ -308,3 +308,85 @@ func (cy *cy) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'cy'
+// 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 (cy *cy) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := cy.currencies[currency]
+ l := len(s) + len(cy.decimal) + len(cy.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(cy.decimal) - 1; j >= 0; j-- {
+ b = append(b, cy.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(cy.group) - 1; j >= 0; j-- {
+ b = append(b, cy.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(cy.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, cy.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, cy.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, cy.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/cy_GB/cy_GB.go b/cy_GB/cy_GB.go
index 31cfeda1..ab28a26f 100644
--- a/cy_GB/cy_GB.go
+++ b/cy_GB/cy_GB.go
@@ -308,3 +308,85 @@ func (cy *cy_GB) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'cy_GB'
+// 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 (cy *cy_GB) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := cy.currencies[currency]
+ l := len(s) + len(cy.decimal) + len(cy.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(cy.decimal) - 1; j >= 0; j-- {
+ b = append(b, cy.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(cy.group) - 1; j >= 0; j-- {
+ b = append(b, cy.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(cy.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, cy.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, cy.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, cy.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/da/da.go b/da/da.go
index b0b7219c..311f2546 100644
--- a/da/da.go
+++ b/da/da.go
@@ -238,3 +238,75 @@ func (da *da) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'da'
+// 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 (da *da) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := da.currencies[currency]
+ l := len(s) + len(da.decimal) + len(da.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, da.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, da.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, da.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, da.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, da.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, da.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/da_DK/da_DK.go b/da_DK/da_DK.go
index acdcb327..5fc52441 100644
--- a/da_DK/da_DK.go
+++ b/da_DK/da_DK.go
@@ -238,3 +238,75 @@ func (da *da_DK) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'da_DK'
+// 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 (da *da_DK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := da.currencies[currency]
+ l := len(s) + len(da.decimal) + len(da.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, da.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, da.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, da.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, da.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, da.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, da.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/da_GL/da_GL.go b/da_GL/da_GL.go
index 65d37e14..71114b11 100644
--- a/da_GL/da_GL.go
+++ b/da_GL/da_GL.go
@@ -238,3 +238,75 @@ func (da *da_GL) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'da_GL'
+// 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 (da *da_GL) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := da.currencies[currency]
+ l := len(s) + len(da.decimal) + len(da.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, da.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, da.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, da.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, da.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, da.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, da.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/dav/dav.go b/dav/dav.go
index 26fbb858..0f764c0b 100644
--- a/dav/dav.go
+++ b/dav/dav.go
@@ -160,3 +160,85 @@ func (dav *dav) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'dav'
+// 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 (dav *dav) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := dav.currencies[currency]
+ l := len(s) + len(dav.decimal) + len(dav.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(dav.decimal) - 1; j >= 0; j-- {
+ b = append(b, dav.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(dav.group) - 1; j >= 0; j-- {
+ b = append(b, dav.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(dav.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, dav.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, dav.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, dav.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/dav_KE/dav_KE.go b/dav_KE/dav_KE.go
index 06e8a8e3..26814faf 100644
--- a/dav_KE/dav_KE.go
+++ b/dav_KE/dav_KE.go
@@ -160,3 +160,85 @@ func (dav *dav_KE) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'dav_KE'
+// 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 (dav *dav_KE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := dav.currencies[currency]
+ l := len(s) + len(dav.decimal) + len(dav.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(dav.decimal) - 1; j >= 0; j-- {
+ b = append(b, dav.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(dav.group) - 1; j >= 0; j-- {
+ b = append(b, dav.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(dav.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, dav.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, dav.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, dav.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/de/de.go b/de/de.go
index 4f97a1e6..475f8690 100644
--- a/de/de.go
+++ b/de/de.go
@@ -235,3 +235,75 @@ func (de *de) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'de'
+// 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 (de *de) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := de.currencies[currency]
+ l := len(s) + len(de.decimal) + len(de.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, de.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, de.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, de.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, de.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, de.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, de.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/de_AT/de_AT.go b/de_AT/de_AT.go
index b5bfc647..87832b66 100644
--- a/de_AT/de_AT.go
+++ b/de_AT/de_AT.go
@@ -245,3 +245,82 @@ func (de *de_AT) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'de_AT'
+// 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 (de *de_AT) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := de.currencies[currency]
+ l := len(s) + len(de.decimal) + len(de.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, de.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(de.group) - 1; j >= 0; j-- {
+ b = append(b, de.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(de.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, de.currencyNegativePrefix[j])
+ }
+
+ b = append(b, de.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(de.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, de.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, de.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/de_BE/de_BE.go b/de_BE/de_BE.go
index 814417ef..536c955f 100644
--- a/de_BE/de_BE.go
+++ b/de_BE/de_BE.go
@@ -235,3 +235,75 @@ func (de *de_BE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'de_BE'
+// 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 (de *de_BE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := de.currencies[currency]
+ l := len(s) + len(de.decimal) + len(de.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, de.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, de.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, de.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, de.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, de.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, de.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/de_CH/de_CH.go b/de_CH/de_CH.go
index 19256fad..af0e0312 100644
--- a/de_CH/de_CH.go
+++ b/de_CH/de_CH.go
@@ -235,3 +235,79 @@ func (de *de_CH) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'de_CH'
+// 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 (de *de_CH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := de.currencies[currency]
+ l := len(s) + len(de.decimal) + len(de.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, de.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, de.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(de.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, de.currencyNegativePrefix[j])
+ }
+
+ b = append(b, de.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(de.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, de.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, de.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/de_DE/de_DE.go b/de_DE/de_DE.go
index 404ae323..f8d5d052 100644
--- a/de_DE/de_DE.go
+++ b/de_DE/de_DE.go
@@ -235,3 +235,75 @@ func (de *de_DE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'de_DE'
+// 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 (de *de_DE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := de.currencies[currency]
+ l := len(s) + len(de.decimal) + len(de.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, de.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, de.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, de.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, de.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, de.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, de.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/de_LI/de_LI.go b/de_LI/de_LI.go
index 1834a830..5626e4d7 100644
--- a/de_LI/de_LI.go
+++ b/de_LI/de_LI.go
@@ -235,3 +235,79 @@ func (de *de_LI) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'de_LI'
+// 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 (de *de_LI) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := de.currencies[currency]
+ l := len(s) + len(de.decimal) + len(de.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, de.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, de.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(de.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, de.currencyNegativePrefix[j])
+ }
+
+ b = append(b, de.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(de.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, de.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, de.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/de_LU/de_LU.go b/de_LU/de_LU.go
index a14a0125..9c3afa76 100644
--- a/de_LU/de_LU.go
+++ b/de_LU/de_LU.go
@@ -235,3 +235,75 @@ func (de *de_LU) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'de_LU'
+// 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 (de *de_LU) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := de.currencies[currency]
+ l := len(s) + len(de.decimal) + len(de.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, de.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, de.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, de.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, de.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, de.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, de.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/dje/dje.go b/dje/dje.go
index acec6e65..de07f259 100644
--- a/dje/dje.go
+++ b/dje/dje.go
@@ -218,3 +218,76 @@ func (dje *dje) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'dje'
+// 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 (dje *dje) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := dje.currencies[currency]
+ l := len(s) + len(dje.decimal) + len(dje.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, dje.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(dje.group) - 1; j >= 0; j-- {
+ b = append(b, dje.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(dje.minus) - 1; j >= 0; j-- {
+ b = append(b, dje.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, dje.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/dje_NE/dje_NE.go b/dje_NE/dje_NE.go
index 1c8e5d1e..067f1109 100644
--- a/dje_NE/dje_NE.go
+++ b/dje_NE/dje_NE.go
@@ -218,3 +218,76 @@ func (dje *dje_NE) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'dje_NE'
+// 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 (dje *dje_NE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := dje.currencies[currency]
+ l := len(s) + len(dje.decimal) + len(dje.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, dje.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(dje.group) - 1; j >= 0; j-- {
+ b = append(b, dje.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(dje.minus) - 1; j >= 0; j-- {
+ b = append(b, dje.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, dje.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/dsb/dsb.go b/dsb/dsb.go
index 4cfca75e..a6323c88 100644
--- a/dsb/dsb.go
+++ b/dsb/dsb.go
@@ -231,3 +231,75 @@ func (dsb *dsb) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'dsb'
+// 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 (dsb *dsb) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := dsb.currencies[currency]
+ l := len(s) + len(dsb.decimal) + len(dsb.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, dsb.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, dsb.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, dsb.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, dsb.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, dsb.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, dsb.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/dsb_DE/dsb_DE.go b/dsb_DE/dsb_DE.go
index 9baaf581..a9b5fb3e 100644
--- a/dsb_DE/dsb_DE.go
+++ b/dsb_DE/dsb_DE.go
@@ -231,3 +231,75 @@ func (dsb *dsb_DE) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'dsb_DE'
+// 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 (dsb *dsb_DE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := dsb.currencies[currency]
+ l := len(s) + len(dsb.decimal) + len(dsb.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, dsb.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, dsb.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, dsb.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, dsb.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, dsb.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, dsb.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/dua/dua.go b/dua/dua.go
index 0546f94f..3d6a8768 100644
--- a/dua/dua.go
+++ b/dua/dua.go
@@ -228,3 +228,80 @@ func (dua *dua) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'dua'
+// 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 (dua *dua) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := dua.currencies[currency]
+ l := len(s) + len(dua.decimal) + len(dua.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, dua.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(dua.group) - 1; j >= 0; j-- {
+ b = append(b, dua.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(dua.minus) - 1; j >= 0; j-- {
+ b = append(b, dua.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, dua.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, dua.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, dua.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/dua_CM/dua_CM.go b/dua_CM/dua_CM.go
index 11b5c951..3a6ef6a4 100644
--- a/dua_CM/dua_CM.go
+++ b/dua_CM/dua_CM.go
@@ -228,3 +228,80 @@ func (dua *dua_CM) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'dua_CM'
+// 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 (dua *dua_CM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := dua.currencies[currency]
+ l := len(s) + len(dua.decimal) + len(dua.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, dua.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(dua.group) - 1; j >= 0; j-- {
+ b = append(b, dua.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(dua.minus) - 1; j >= 0; j-- {
+ b = append(b, dua.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, dua.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, dua.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, dua.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/dyo/dyo.go b/dyo/dyo.go
index 84375728..ac8a02de 100644
--- a/dyo/dyo.go
+++ b/dyo/dyo.go
@@ -224,3 +224,80 @@ func (dyo *dyo) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'dyo'
+// 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 (dyo *dyo) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := dyo.currencies[currency]
+ l := len(s) + len(dyo.decimal) + len(dyo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, dyo.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(dyo.group) - 1; j >= 0; j-- {
+ b = append(b, dyo.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(dyo.minus) - 1; j >= 0; j-- {
+ b = append(b, dyo.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, dyo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, dyo.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, dyo.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/dyo_SN/dyo_SN.go b/dyo_SN/dyo_SN.go
index 7ffb51f9..d00790ed 100644
--- a/dyo_SN/dyo_SN.go
+++ b/dyo_SN/dyo_SN.go
@@ -224,3 +224,80 @@ func (dyo *dyo_SN) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'dyo_SN'
+// 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 (dyo *dyo_SN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := dyo.currencies[currency]
+ l := len(s) + len(dyo.decimal) + len(dyo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, dyo.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(dyo.group) - 1; j >= 0; j-- {
+ b = append(b, dyo.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(dyo.minus) - 1; j >= 0; j-- {
+ b = append(b, dyo.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, dyo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, dyo.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, dyo.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/dz/dz.go b/dz/dz.go
index bc6df2c3..b2087db0 100644
--- a/dz/dz.go
+++ b/dz/dz.go
@@ -230,3 +230,80 @@ func (dz *dz) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'dz'
+// 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 (dz *dz) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := dz.currencies[currency]
+ l := len(s) + len(dz.decimal) + len(dz.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, dz.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ b = append(b, dz.group[0])
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, dz.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, dz.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/dz_BT/dz_BT.go b/dz_BT/dz_BT.go
index 31eb8a5e..dbf04883 100644
--- a/dz_BT/dz_BT.go
+++ b/dz_BT/dz_BT.go
@@ -230,3 +230,80 @@ func (dz *dz_BT) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'dz_BT'
+// 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 (dz *dz_BT) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := dz.currencies[currency]
+ l := len(s) + len(dz.decimal) + len(dz.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, dz.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ b = append(b, dz.group[0])
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, dz.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, dz.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ebu/ebu.go b/ebu/ebu.go
index 8c60ad24..89756e62 100644
--- a/ebu/ebu.go
+++ b/ebu/ebu.go
@@ -160,3 +160,85 @@ func (ebu *ebu) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ebu'
+// 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 (ebu *ebu) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ebu.currencies[currency]
+ l := len(s) + len(ebu.decimal) + len(ebu.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ebu.decimal) - 1; j >= 0; j-- {
+ b = append(b, ebu.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ebu.group) - 1; j >= 0; j-- {
+ b = append(b, ebu.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ebu.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ebu.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ebu.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ebu.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ebu_KE/ebu_KE.go b/ebu_KE/ebu_KE.go
index dbc76e8a..25c10665 100644
--- a/ebu_KE/ebu_KE.go
+++ b/ebu_KE/ebu_KE.go
@@ -160,3 +160,85 @@ func (ebu *ebu_KE) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ebu_KE'
+// 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 (ebu *ebu_KE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ebu.currencies[currency]
+ l := len(s) + len(ebu.decimal) + len(ebu.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ebu.decimal) - 1; j >= 0; j-- {
+ b = append(b, ebu.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ebu.group) - 1; j >= 0; j-- {
+ b = append(b, ebu.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ebu.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ebu.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ebu.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ebu.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ee/ee.go b/ee/ee.go
index cfdac898..563aae66 100644
--- a/ee/ee.go
+++ b/ee/ee.go
@@ -167,3 +167,85 @@ func (ee *ee) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ee'
+// 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 (ee *ee) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ee.currencies[currency]
+ l := len(s) + len(ee.decimal) + len(ee.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ee.decimal) - 1; j >= 0; j-- {
+ b = append(b, ee.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ee.group) - 1; j >= 0; j-- {
+ b = append(b, ee.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ee.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ee.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ee.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ee.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ee_GH/ee_GH.go b/ee_GH/ee_GH.go
index 0e550398..b49e5118 100644
--- a/ee_GH/ee_GH.go
+++ b/ee_GH/ee_GH.go
@@ -167,3 +167,85 @@ func (ee *ee_GH) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ee_GH'
+// 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 (ee *ee_GH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ee.currencies[currency]
+ l := len(s) + len(ee.decimal) + len(ee.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ee.decimal) - 1; j >= 0; j-- {
+ b = append(b, ee.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ee.group) - 1; j >= 0; j-- {
+ b = append(b, ee.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ee.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ee.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ee.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ee.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ee_TG/ee_TG.go b/ee_TG/ee_TG.go
index b381c662..1cf2513c 100644
--- a/ee_TG/ee_TG.go
+++ b/ee_TG/ee_TG.go
@@ -167,3 +167,85 @@ func (ee *ee_TG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ee_TG'
+// 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 (ee *ee_TG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ee.currencies[currency]
+ l := len(s) + len(ee.decimal) + len(ee.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ee.decimal) - 1; j >= 0; j-- {
+ b = append(b, ee.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ee.group) - 1; j >= 0; j-- {
+ b = append(b, ee.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ee.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ee.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ee.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ee.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/el/el.go b/el/el.go
index 27754e43..1089bec4 100644
--- a/el/el.go
+++ b/el/el.go
@@ -232,3 +232,77 @@ func (el *el) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'el'
+// 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 (el *el) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := el.currencies[currency]
+ l := len(s) + len(el.decimal) + len(el.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, el.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, el.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(el.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, el.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, el.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, el.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, el.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/el_CY/el_CY.go b/el_CY/el_CY.go
index 297142ef..e0bc797c 100644
--- a/el_CY/el_CY.go
+++ b/el_CY/el_CY.go
@@ -232,3 +232,77 @@ func (el *el_CY) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'el_CY'
+// 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 (el *el_CY) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := el.currencies[currency]
+ l := len(s) + len(el.decimal) + len(el.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, el.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, el.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(el.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, el.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, el.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, el.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, el.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/el_GR/el_GR.go b/el_GR/el_GR.go
index 425ced29..4723304d 100644
--- a/el_GR/el_GR.go
+++ b/el_GR/el_GR.go
@@ -232,3 +232,77 @@ func (el *el_GR) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'el_GR'
+// 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 (el *el_GR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := el.currencies[currency]
+ l := len(s) + len(el.decimal) + len(el.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, el.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, el.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(el.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, el.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, el.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, el.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, el.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/en/en.go b/en/en.go
index b6863b31..043f6721 100644
--- a/en/en.go
+++ b/en/en.go
@@ -76,8 +76,8 @@ func (en *en) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (en *en) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod10 := math.Mod(n, 10)
nMod100 := math.Mod(n, 100)
+ nMod10 := math.Mod(n, 10)
if nMod10 == 1 && nMod100 != 11 {
return locales.PluralRuleOne
@@ -233,3 +233,79 @@ func (en *en) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en'
+// 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 (en *en) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en/en_test.go b/en/en_test.go
index 45ab2255..335feefa 100644
--- a/en/en_test.go
+++ b/en/en_test.go
@@ -44,3 +44,42 @@ func TestCurrency(t *testing.T) {
}
}
}
+
+func TestAccounting(t *testing.T) {
+
+ tests := []struct {
+ num float64
+ v uint64
+ expected string
+ }{
+ {
+ num: 1123456.5643,
+ v: 2,
+ expected: "$1,123,456.56",
+ },
+ {
+ num: 1123456.5643,
+ v: 1,
+ expected: "$1,123,456.60",
+ },
+ {
+ num: 221123456.5643,
+ v: 3,
+ expected: "$221,123,456.564",
+ },
+ {
+ num: -221123456.5643,
+ v: 3,
+ expected: "($221,123,456.564)",
+ },
+ }
+
+ trans := New()
+
+ for _, tt := range tests {
+ s := string(trans.FmtAccounting(tt.num, tt.v, currency.USD))
+ if s != tt.expected {
+ t.Errorf("Expected '%s' Got '%s", tt.expected, s)
+ }
+ }
+}
diff --git a/en_001/en_001.go b/en_001/en_001.go
index 66ca6bc5..4d559b5e 100644
--- a/en_001/en_001.go
+++ b/en_001/en_001.go
@@ -76,8 +76,8 @@ func (en *en_001) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (en *en_001) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod10 := math.Mod(n, 10)
nMod100 := math.Mod(n, 100)
+ nMod10 := math.Mod(n, 10)
if nMod10 == 1 && nMod100 != 11 {
return locales.PluralRuleOne
@@ -233,3 +233,79 @@ func (en *en_001) FmtCurrency(num float64, v uint64, currency currency.Type) []b
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_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 (en *en_001) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_150/en_150.go b/en_150/en_150.go
index f0349ca2..832d475a 100644
--- a/en_150/en_150.go
+++ b/en_150/en_150.go
@@ -76,8 +76,8 @@ func (en *en_150) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (en *en_150) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod100 := math.Mod(n, 100)
nMod10 := math.Mod(n, 10)
+ nMod100 := math.Mod(n, 100)
if nMod10 == 1 && nMod100 != 11 {
return locales.PluralRuleOne
@@ -233,3 +233,75 @@ func (en *en_150) FmtCurrency(num float64, v uint64, currency currency.Type) []b
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_150'
+// 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 (en *en_150) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, en.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, en.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/en_AG/en_AG.go b/en_AG/en_AG.go
index ba1e0db5..3827d04a 100644
--- a/en_AG/en_AG.go
+++ b/en_AG/en_AG.go
@@ -233,3 +233,79 @@ func (en *en_AG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_AG'
+// 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 (en *en_AG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_AI/en_AI.go b/en_AI/en_AI.go
index 0335725a..42e1748c 100644
--- a/en_AI/en_AI.go
+++ b/en_AI/en_AI.go
@@ -76,8 +76,8 @@ func (en *en_AI) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (en *en_AI) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod10 := math.Mod(n, 10)
nMod100 := math.Mod(n, 100)
+ nMod10 := math.Mod(n, 10)
if nMod10 == 1 && nMod100 != 11 {
return locales.PluralRuleOne
@@ -233,3 +233,79 @@ func (en *en_AI) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_AI'
+// 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 (en *en_AI) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_AS/en_AS.go b/en_AS/en_AS.go
index d0f51a3d..89757cd1 100644
--- a/en_AS/en_AS.go
+++ b/en_AS/en_AS.go
@@ -233,3 +233,79 @@ func (en *en_AS) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_AS'
+// 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 (en *en_AS) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_AT/en_AT.go b/en_AT/en_AT.go
index 78068b5c..8d8c99b5 100644
--- a/en_AT/en_AT.go
+++ b/en_AT/en_AT.go
@@ -241,3 +241,79 @@ func (en *en_AT) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_AT'
+// 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 (en *en_AT) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ b = append(b, en.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/en_AU/en_AU.go b/en_AU/en_AU.go
index ff342e2b..57724508 100644
--- a/en_AU/en_AU.go
+++ b/en_AU/en_AU.go
@@ -233,3 +233,79 @@ func (en *en_AU) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_AU'
+// 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 (en *en_AU) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_BB/en_BB.go b/en_BB/en_BB.go
index a47c7c9e..90bf07e7 100644
--- a/en_BB/en_BB.go
+++ b/en_BB/en_BB.go
@@ -233,3 +233,79 @@ func (en *en_BB) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_BB'
+// 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 (en *en_BB) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_BE/en_BE.go b/en_BE/en_BE.go
index d94bfb46..0db622e2 100644
--- a/en_BE/en_BE.go
+++ b/en_BE/en_BE.go
@@ -233,3 +233,75 @@ func (en *en_BE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_BE'
+// 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 (en *en_BE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, en.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, en.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/en_BI/en_BI.go b/en_BI/en_BI.go
index 34ded216..bd930abf 100644
--- a/en_BI/en_BI.go
+++ b/en_BI/en_BI.go
@@ -233,3 +233,79 @@ func (en *en_BI) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_BI'
+// 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 (en *en_BI) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_BM/en_BM.go b/en_BM/en_BM.go
index a39c8ac4..3ef53baa 100644
--- a/en_BM/en_BM.go
+++ b/en_BM/en_BM.go
@@ -233,3 +233,79 @@ func (en *en_BM) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_BM'
+// 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 (en *en_BM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_BS/en_BS.go b/en_BS/en_BS.go
index e6f5d679..ac03b2c4 100644
--- a/en_BS/en_BS.go
+++ b/en_BS/en_BS.go
@@ -233,3 +233,79 @@ func (en *en_BS) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_BS'
+// 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 (en *en_BS) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_BW/en_BW.go b/en_BW/en_BW.go
index 432d68da..d5cab1eb 100644
--- a/en_BW/en_BW.go
+++ b/en_BW/en_BW.go
@@ -233,3 +233,79 @@ func (en *en_BW) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_BW'
+// 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 (en *en_BW) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_BZ/en_BZ.go b/en_BZ/en_BZ.go
index cce98743..b6185d6c 100644
--- a/en_BZ/en_BZ.go
+++ b/en_BZ/en_BZ.go
@@ -233,3 +233,79 @@ func (en *en_BZ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_BZ'
+// 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 (en *en_BZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_CA/en_CA.go b/en_CA/en_CA.go
index 2d8fcaa1..53ce0be9 100644
--- a/en_CA/en_CA.go
+++ b/en_CA/en_CA.go
@@ -233,3 +233,79 @@ func (en *en_CA) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_CA'
+// 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 (en *en_CA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_CC/en_CC.go b/en_CC/en_CC.go
index 5d45e18d..241e8509 100644
--- a/en_CC/en_CC.go
+++ b/en_CC/en_CC.go
@@ -76,8 +76,8 @@ func (en *en_CC) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (en *en_CC) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod100 := math.Mod(n, 100)
nMod10 := math.Mod(n, 10)
+ nMod100 := math.Mod(n, 100)
if nMod10 == 1 && nMod100 != 11 {
return locales.PluralRuleOne
@@ -233,3 +233,79 @@ func (en *en_CC) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_CC'
+// 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 (en *en_CC) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_CH/en_CH.go b/en_CH/en_CH.go
index a45a9487..3b53dca7 100644
--- a/en_CH/en_CH.go
+++ b/en_CH/en_CH.go
@@ -237,3 +237,77 @@ func (en *en_CH) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_CH'
+// 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 (en *en_CH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/en_CK/en_CK.go b/en_CK/en_CK.go
index de6fb475..ec81c098 100644
--- a/en_CK/en_CK.go
+++ b/en_CK/en_CK.go
@@ -233,3 +233,79 @@ func (en *en_CK) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_CK'
+// 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 (en *en_CK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_CM/en_CM.go b/en_CM/en_CM.go
index ad22647e..dd861763 100644
--- a/en_CM/en_CM.go
+++ b/en_CM/en_CM.go
@@ -233,3 +233,79 @@ func (en *en_CM) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_CM'
+// 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 (en *en_CM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_CX/en_CX.go b/en_CX/en_CX.go
index 3624e5a3..6de086d3 100644
--- a/en_CX/en_CX.go
+++ b/en_CX/en_CX.go
@@ -233,3 +233,79 @@ func (en *en_CX) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_CX'
+// 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 (en *en_CX) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_CY/en_CY.go b/en_CY/en_CY.go
index ed431970..44a76db9 100644
--- a/en_CY/en_CY.go
+++ b/en_CY/en_CY.go
@@ -76,8 +76,8 @@ func (en *en_CY) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (en *en_CY) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod10 := math.Mod(n, 10)
nMod100 := math.Mod(n, 100)
+ nMod10 := math.Mod(n, 10)
if nMod10 == 1 && nMod100 != 11 {
return locales.PluralRuleOne
@@ -233,3 +233,79 @@ func (en *en_CY) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_CY'
+// 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 (en *en_CY) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_DE/en_DE.go b/en_DE/en_DE.go
index ead23ab4..7a19eb95 100644
--- a/en_DE/en_DE.go
+++ b/en_DE/en_DE.go
@@ -237,3 +237,79 @@ func (en *en_DE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_DE'
+// 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 (en *en_DE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_DG/en_DG.go b/en_DG/en_DG.go
index dc8d03ae..d3807881 100644
--- a/en_DG/en_DG.go
+++ b/en_DG/en_DG.go
@@ -233,3 +233,79 @@ func (en *en_DG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_DG'
+// 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 (en *en_DG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_DK/en_DK.go b/en_DK/en_DK.go
index 5cea9f1d..c806b3ec 100644
--- a/en_DK/en_DK.go
+++ b/en_DK/en_DK.go
@@ -237,3 +237,79 @@ func (en *en_DK) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_DK'
+// 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 (en *en_DK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_DM/en_DM.go b/en_DM/en_DM.go
index 52e5b78e..18f7ca3d 100644
--- a/en_DM/en_DM.go
+++ b/en_DM/en_DM.go
@@ -233,3 +233,79 @@ func (en *en_DM) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_DM'
+// 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 (en *en_DM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_ER/en_ER.go b/en_ER/en_ER.go
index cd57f0aa..31c5f582 100644
--- a/en_ER/en_ER.go
+++ b/en_ER/en_ER.go
@@ -76,8 +76,8 @@ func (en *en_ER) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (en *en_ER) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod100 := math.Mod(n, 100)
nMod10 := math.Mod(n, 10)
+ nMod100 := math.Mod(n, 100)
if nMod10 == 1 && nMod100 != 11 {
return locales.PluralRuleOne
@@ -233,3 +233,79 @@ func (en *en_ER) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_ER'
+// 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 (en *en_ER) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_FI/en_FI.go b/en_FI/en_FI.go
index 56bc352c..3c360017 100644
--- a/en_FI/en_FI.go
+++ b/en_FI/en_FI.go
@@ -243,3 +243,82 @@ func (en *en_FI) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_FI'
+// 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 (en *en_FI) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(en.group) - 1; j >= 0; j-- {
+ b = append(b, en.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_FJ/en_FJ.go b/en_FJ/en_FJ.go
index 18748683..c646ac3b 100644
--- a/en_FJ/en_FJ.go
+++ b/en_FJ/en_FJ.go
@@ -233,3 +233,79 @@ func (en *en_FJ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_FJ'
+// 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 (en *en_FJ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_FK/en_FK.go b/en_FK/en_FK.go
index 70d677e6..5801670d 100644
--- a/en_FK/en_FK.go
+++ b/en_FK/en_FK.go
@@ -233,3 +233,79 @@ func (en *en_FK) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_FK'
+// 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 (en *en_FK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_FM/en_FM.go b/en_FM/en_FM.go
index 68aaa056..ce19d381 100644
--- a/en_FM/en_FM.go
+++ b/en_FM/en_FM.go
@@ -233,3 +233,79 @@ func (en *en_FM) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_FM'
+// 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 (en *en_FM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_GB/en_GB.go b/en_GB/en_GB.go
index 664e27fe..81a73374 100644
--- a/en_GB/en_GB.go
+++ b/en_GB/en_GB.go
@@ -233,3 +233,79 @@ func (en *en_GB) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_GB'
+// 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 (en *en_GB) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_GD/en_GD.go b/en_GD/en_GD.go
index 7e25e6d5..ab7596cb 100644
--- a/en_GD/en_GD.go
+++ b/en_GD/en_GD.go
@@ -233,3 +233,79 @@ func (en *en_GD) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_GD'
+// 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 (en *en_GD) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_GG/en_GG.go b/en_GG/en_GG.go
index 292ec700..253eb718 100644
--- a/en_GG/en_GG.go
+++ b/en_GG/en_GG.go
@@ -233,3 +233,79 @@ func (en *en_GG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_GG'
+// 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 (en *en_GG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_GH/en_GH.go b/en_GH/en_GH.go
index 6f4b9463..095329b8 100644
--- a/en_GH/en_GH.go
+++ b/en_GH/en_GH.go
@@ -233,3 +233,79 @@ func (en *en_GH) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_GH'
+// 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 (en *en_GH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_GI/en_GI.go b/en_GI/en_GI.go
index d7c8c2cc..b59560fd 100644
--- a/en_GI/en_GI.go
+++ b/en_GI/en_GI.go
@@ -233,3 +233,79 @@ func (en *en_GI) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_GI'
+// 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 (en *en_GI) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_GM/en_GM.go b/en_GM/en_GM.go
index 9d83d79b..eb7295b6 100644
--- a/en_GM/en_GM.go
+++ b/en_GM/en_GM.go
@@ -233,3 +233,79 @@ func (en *en_GM) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_GM'
+// 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 (en *en_GM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_GU/en_GU.go b/en_GU/en_GU.go
index 3ecfe5f1..ec624e76 100644
--- a/en_GU/en_GU.go
+++ b/en_GU/en_GU.go
@@ -76,8 +76,8 @@ func (en *en_GU) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (en *en_GU) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod100 := math.Mod(n, 100)
nMod10 := math.Mod(n, 10)
+ nMod100 := math.Mod(n, 100)
if nMod10 == 1 && nMod100 != 11 {
return locales.PluralRuleOne
@@ -233,3 +233,79 @@ func (en *en_GU) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_GU'
+// 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 (en *en_GU) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_GY/en_GY.go b/en_GY/en_GY.go
index 4306cbfc..ab33f554 100644
--- a/en_GY/en_GY.go
+++ b/en_GY/en_GY.go
@@ -233,3 +233,79 @@ func (en *en_GY) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_GY'
+// 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 (en *en_GY) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_HK/en_HK.go b/en_HK/en_HK.go
index 7a5a3b36..327a77ae 100644
--- a/en_HK/en_HK.go
+++ b/en_HK/en_HK.go
@@ -233,3 +233,79 @@ func (en *en_HK) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_HK'
+// 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 (en *en_HK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_IE/en_IE.go b/en_IE/en_IE.go
index ef05dda7..c75dbfa6 100644
--- a/en_IE/en_IE.go
+++ b/en_IE/en_IE.go
@@ -233,3 +233,79 @@ func (en *en_IE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_IE'
+// 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 (en *en_IE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_IL/en_IL.go b/en_IL/en_IL.go
index b041961b..4183a1fc 100644
--- a/en_IL/en_IL.go
+++ b/en_IL/en_IL.go
@@ -233,3 +233,79 @@ func (en *en_IL) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_IL'
+// 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 (en *en_IL) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_IM/en_IM.go b/en_IM/en_IM.go
index b5871427..5e16d247 100644
--- a/en_IM/en_IM.go
+++ b/en_IM/en_IM.go
@@ -233,3 +233,79 @@ func (en *en_IM) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_IM'
+// 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 (en *en_IM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_IN/en_IN.go b/en_IN/en_IN.go
index 3ddc13b3..72505f93 100644
--- a/en_IN/en_IN.go
+++ b/en_IN/en_IN.go
@@ -255,3 +255,88 @@ func (en *en_IN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_IN'
+// 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 (en *en_IN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ b = append(b, en.group[0])
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ b = append(b, en.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/en_IO/en_IO.go b/en_IO/en_IO.go
index a809572c..f42d4fdb 100644
--- a/en_IO/en_IO.go
+++ b/en_IO/en_IO.go
@@ -76,8 +76,8 @@ func (en *en_IO) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (en *en_IO) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod10 := math.Mod(n, 10)
nMod100 := math.Mod(n, 100)
+ nMod10 := math.Mod(n, 10)
if nMod10 == 1 && nMod100 != 11 {
return locales.PluralRuleOne
@@ -233,3 +233,79 @@ func (en *en_IO) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_IO'
+// 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 (en *en_IO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_JE/en_JE.go b/en_JE/en_JE.go
index e0d9aa73..63888625 100644
--- a/en_JE/en_JE.go
+++ b/en_JE/en_JE.go
@@ -233,3 +233,79 @@ func (en *en_JE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_JE'
+// 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 (en *en_JE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_JM/en_JM.go b/en_JM/en_JM.go
index 011799a9..b4893c27 100644
--- a/en_JM/en_JM.go
+++ b/en_JM/en_JM.go
@@ -76,8 +76,8 @@ func (en *en_JM) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (en *en_JM) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod100 := math.Mod(n, 100)
nMod10 := math.Mod(n, 10)
+ nMod100 := math.Mod(n, 100)
if nMod10 == 1 && nMod100 != 11 {
return locales.PluralRuleOne
@@ -233,3 +233,79 @@ func (en *en_JM) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_JM'
+// 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 (en *en_JM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_KE/en_KE.go b/en_KE/en_KE.go
index a5564580..10d1b68a 100644
--- a/en_KE/en_KE.go
+++ b/en_KE/en_KE.go
@@ -76,8 +76,8 @@ func (en *en_KE) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (en *en_KE) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod10 := math.Mod(n, 10)
nMod100 := math.Mod(n, 100)
+ nMod10 := math.Mod(n, 10)
if nMod10 == 1 && nMod100 != 11 {
return locales.PluralRuleOne
@@ -233,3 +233,79 @@ func (en *en_KE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_KE'
+// 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 (en *en_KE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_KI/en_KI.go b/en_KI/en_KI.go
index cf9b708e..7fa32e62 100644
--- a/en_KI/en_KI.go
+++ b/en_KI/en_KI.go
@@ -76,8 +76,8 @@ func (en *en_KI) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (en *en_KI) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod10 := math.Mod(n, 10)
nMod100 := math.Mod(n, 100)
+ nMod10 := math.Mod(n, 10)
if nMod10 == 1 && nMod100 != 11 {
return locales.PluralRuleOne
@@ -233,3 +233,79 @@ func (en *en_KI) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_KI'
+// 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 (en *en_KI) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_KN/en_KN.go b/en_KN/en_KN.go
index 03c839ef..1ce73167 100644
--- a/en_KN/en_KN.go
+++ b/en_KN/en_KN.go
@@ -233,3 +233,79 @@ func (en *en_KN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_KN'
+// 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 (en *en_KN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_KY/en_KY.go b/en_KY/en_KY.go
index 6ab1d0ad..7f0e2027 100644
--- a/en_KY/en_KY.go
+++ b/en_KY/en_KY.go
@@ -233,3 +233,79 @@ func (en *en_KY) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_KY'
+// 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 (en *en_KY) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_LC/en_LC.go b/en_LC/en_LC.go
index 786cb508..a5ab887a 100644
--- a/en_LC/en_LC.go
+++ b/en_LC/en_LC.go
@@ -233,3 +233,79 @@ func (en *en_LC) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_LC'
+// 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 (en *en_LC) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_LR/en_LR.go b/en_LR/en_LR.go
index f60387ed..151f4518 100644
--- a/en_LR/en_LR.go
+++ b/en_LR/en_LR.go
@@ -233,3 +233,79 @@ func (en *en_LR) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_LR'
+// 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 (en *en_LR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_LS/en_LS.go b/en_LS/en_LS.go
index 318240f1..29b1242b 100644
--- a/en_LS/en_LS.go
+++ b/en_LS/en_LS.go
@@ -233,3 +233,79 @@ func (en *en_LS) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_LS'
+// 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 (en *en_LS) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_MG/en_MG.go b/en_MG/en_MG.go
index 38865b38..0ee20fbf 100644
--- a/en_MG/en_MG.go
+++ b/en_MG/en_MG.go
@@ -76,8 +76,8 @@ func (en *en_MG) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (en *en_MG) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod10 := math.Mod(n, 10)
nMod100 := math.Mod(n, 100)
+ nMod10 := math.Mod(n, 10)
if nMod10 == 1 && nMod100 != 11 {
return locales.PluralRuleOne
@@ -233,3 +233,79 @@ func (en *en_MG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_MG'
+// 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 (en *en_MG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_MH/en_MH.go b/en_MH/en_MH.go
index 3bc1fb93..124c0084 100644
--- a/en_MH/en_MH.go
+++ b/en_MH/en_MH.go
@@ -233,3 +233,79 @@ func (en *en_MH) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_MH'
+// 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 (en *en_MH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_MO/en_MO.go b/en_MO/en_MO.go
index 837e0fc0..f0147957 100644
--- a/en_MO/en_MO.go
+++ b/en_MO/en_MO.go
@@ -233,3 +233,79 @@ func (en *en_MO) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_MO'
+// 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 (en *en_MO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_MP/en_MP.go b/en_MP/en_MP.go
index 63bfddaf..ee6ceb7b 100644
--- a/en_MP/en_MP.go
+++ b/en_MP/en_MP.go
@@ -233,3 +233,79 @@ func (en *en_MP) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_MP'
+// 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 (en *en_MP) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_MS/en_MS.go b/en_MS/en_MS.go
index 56ef572e..0342fa0a 100644
--- a/en_MS/en_MS.go
+++ b/en_MS/en_MS.go
@@ -233,3 +233,79 @@ func (en *en_MS) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_MS'
+// 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 (en *en_MS) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_MT/en_MT.go b/en_MT/en_MT.go
index 7c7d626c..b1ef79b4 100644
--- a/en_MT/en_MT.go
+++ b/en_MT/en_MT.go
@@ -233,3 +233,79 @@ func (en *en_MT) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_MT'
+// 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 (en *en_MT) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_MU/en_MU.go b/en_MU/en_MU.go
index caaa96fa..eafe540d 100644
--- a/en_MU/en_MU.go
+++ b/en_MU/en_MU.go
@@ -233,3 +233,79 @@ func (en *en_MU) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_MU'
+// 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 (en *en_MU) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_MW/en_MW.go b/en_MW/en_MW.go
index 5b571b99..e2d4e81b 100644
--- a/en_MW/en_MW.go
+++ b/en_MW/en_MW.go
@@ -233,3 +233,79 @@ func (en *en_MW) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_MW'
+// 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 (en *en_MW) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_MY/en_MY.go b/en_MY/en_MY.go
index f5921893..a12d7c1c 100644
--- a/en_MY/en_MY.go
+++ b/en_MY/en_MY.go
@@ -233,3 +233,79 @@ func (en *en_MY) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_MY'
+// 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 (en *en_MY) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_NA/en_NA.go b/en_NA/en_NA.go
index ec714b11..51a54d1e 100644
--- a/en_NA/en_NA.go
+++ b/en_NA/en_NA.go
@@ -233,3 +233,79 @@ func (en *en_NA) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_NA'
+// 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 (en *en_NA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_NF/en_NF.go b/en_NF/en_NF.go
index 308ffa04..aa4d5b19 100644
--- a/en_NF/en_NF.go
+++ b/en_NF/en_NF.go
@@ -233,3 +233,79 @@ func (en *en_NF) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_NF'
+// 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 (en *en_NF) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_NG/en_NG.go b/en_NG/en_NG.go
index 35c0231a..e6ba8538 100644
--- a/en_NG/en_NG.go
+++ b/en_NG/en_NG.go
@@ -233,3 +233,79 @@ func (en *en_NG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_NG'
+// 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 (en *en_NG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_NL/en_NL.go b/en_NL/en_NL.go
index b3dcf29b..5891ba64 100644
--- a/en_NL/en_NL.go
+++ b/en_NL/en_NL.go
@@ -239,3 +239,83 @@ func (en *en_NL) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_NL'
+// 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 (en *en_NL) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_NR/en_NR.go b/en_NR/en_NR.go
index 3c266165..a85e094a 100644
--- a/en_NR/en_NR.go
+++ b/en_NR/en_NR.go
@@ -233,3 +233,79 @@ func (en *en_NR) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_NR'
+// 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 (en *en_NR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_NU/en_NU.go b/en_NU/en_NU.go
index bfe811a7..a24fcd71 100644
--- a/en_NU/en_NU.go
+++ b/en_NU/en_NU.go
@@ -233,3 +233,79 @@ func (en *en_NU) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_NU'
+// 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 (en *en_NU) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_NZ/en_NZ.go b/en_NZ/en_NZ.go
index 1fe65eba..9ab1fb24 100644
--- a/en_NZ/en_NZ.go
+++ b/en_NZ/en_NZ.go
@@ -233,3 +233,79 @@ func (en *en_NZ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_NZ'
+// 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 (en *en_NZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_PG/en_PG.go b/en_PG/en_PG.go
index d740c01e..2e8be3e8 100644
--- a/en_PG/en_PG.go
+++ b/en_PG/en_PG.go
@@ -233,3 +233,79 @@ func (en *en_PG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_PG'
+// 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 (en *en_PG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_PH/en_PH.go b/en_PH/en_PH.go
index c364863a..30098b51 100644
--- a/en_PH/en_PH.go
+++ b/en_PH/en_PH.go
@@ -233,3 +233,79 @@ func (en *en_PH) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_PH'
+// 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 (en *en_PH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_PK/en_PK.go b/en_PK/en_PK.go
index e774588a..15ce09af 100644
--- a/en_PK/en_PK.go
+++ b/en_PK/en_PK.go
@@ -233,3 +233,79 @@ func (en *en_PK) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_PK'
+// 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 (en *en_PK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_PN/en_PN.go b/en_PN/en_PN.go
index c44589ce..7a7b8147 100644
--- a/en_PN/en_PN.go
+++ b/en_PN/en_PN.go
@@ -233,3 +233,79 @@ func (en *en_PN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_PN'
+// 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 (en *en_PN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_PR/en_PR.go b/en_PR/en_PR.go
index 6bb57109..0a0b566a 100644
--- a/en_PR/en_PR.go
+++ b/en_PR/en_PR.go
@@ -76,8 +76,8 @@ func (en *en_PR) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (en *en_PR) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod100 := math.Mod(n, 100)
nMod10 := math.Mod(n, 10)
+ nMod100 := math.Mod(n, 100)
if nMod10 == 1 && nMod100 != 11 {
return locales.PluralRuleOne
@@ -233,3 +233,79 @@ func (en *en_PR) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_PR'
+// 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 (en *en_PR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_PW/en_PW.go b/en_PW/en_PW.go
index 8711b954..54cd8a98 100644
--- a/en_PW/en_PW.go
+++ b/en_PW/en_PW.go
@@ -233,3 +233,79 @@ func (en *en_PW) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_PW'
+// 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 (en *en_PW) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_RW/en_RW.go b/en_RW/en_RW.go
index 6ee5e001..f0602832 100644
--- a/en_RW/en_RW.go
+++ b/en_RW/en_RW.go
@@ -233,3 +233,79 @@ func (en *en_RW) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_RW'
+// 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 (en *en_RW) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_SB/en_SB.go b/en_SB/en_SB.go
index 32d0f77f..a81e8028 100644
--- a/en_SB/en_SB.go
+++ b/en_SB/en_SB.go
@@ -233,3 +233,79 @@ func (en *en_SB) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_SB'
+// 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 (en *en_SB) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_SC/en_SC.go b/en_SC/en_SC.go
index 0dfdfc1d..1bf0f9f9 100644
--- a/en_SC/en_SC.go
+++ b/en_SC/en_SC.go
@@ -233,3 +233,79 @@ func (en *en_SC) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_SC'
+// 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 (en *en_SC) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_SD/en_SD.go b/en_SD/en_SD.go
index cd7dfb2f..6a9731a6 100644
--- a/en_SD/en_SD.go
+++ b/en_SD/en_SD.go
@@ -233,3 +233,79 @@ func (en *en_SD) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_SD'
+// 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 (en *en_SD) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_SE/en_SE.go b/en_SE/en_SE.go
index 5e1877cc..b37108c2 100644
--- a/en_SE/en_SE.go
+++ b/en_SE/en_SE.go
@@ -243,3 +243,82 @@ func (en *en_SE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_SE'
+// 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 (en *en_SE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(en.group) - 1; j >= 0; j-- {
+ b = append(b, en.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_SG/en_SG.go b/en_SG/en_SG.go
index 53a10e35..ea47b7fc 100644
--- a/en_SG/en_SG.go
+++ b/en_SG/en_SG.go
@@ -233,3 +233,79 @@ func (en *en_SG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_SG'
+// 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 (en *en_SG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_SH/en_SH.go b/en_SH/en_SH.go
index de181141..98fa6fbe 100644
--- a/en_SH/en_SH.go
+++ b/en_SH/en_SH.go
@@ -233,3 +233,79 @@ func (en *en_SH) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_SH'
+// 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 (en *en_SH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_SI/en_SI.go b/en_SI/en_SI.go
index e21ab0f8..2e301137 100644
--- a/en_SI/en_SI.go
+++ b/en_SI/en_SI.go
@@ -233,3 +233,75 @@ func (en *en_SI) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_SI'
+// 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 (en *en_SI) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, en.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, en.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/en_SL/en_SL.go b/en_SL/en_SL.go
index cfe63ae5..a7e27612 100644
--- a/en_SL/en_SL.go
+++ b/en_SL/en_SL.go
@@ -233,3 +233,79 @@ func (en *en_SL) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_SL'
+// 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 (en *en_SL) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_SS/en_SS.go b/en_SS/en_SS.go
index c1e1f78f..4053240b 100644
--- a/en_SS/en_SS.go
+++ b/en_SS/en_SS.go
@@ -233,3 +233,79 @@ func (en *en_SS) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_SS'
+// 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 (en *en_SS) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_SX/en_SX.go b/en_SX/en_SX.go
index 94d8a97c..0cadafe7 100644
--- a/en_SX/en_SX.go
+++ b/en_SX/en_SX.go
@@ -76,8 +76,8 @@ func (en *en_SX) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (en *en_SX) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod100 := math.Mod(n, 100)
nMod10 := math.Mod(n, 10)
+ nMod100 := math.Mod(n, 100)
if nMod10 == 1 && nMod100 != 11 {
return locales.PluralRuleOne
@@ -233,3 +233,79 @@ func (en *en_SX) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_SX'
+// 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 (en *en_SX) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_SZ/en_SZ.go b/en_SZ/en_SZ.go
index 94547cbe..1a9fa4f6 100644
--- a/en_SZ/en_SZ.go
+++ b/en_SZ/en_SZ.go
@@ -233,3 +233,79 @@ func (en *en_SZ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_SZ'
+// 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 (en *en_SZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_TC/en_TC.go b/en_TC/en_TC.go
index 1f946105..141f0391 100644
--- a/en_TC/en_TC.go
+++ b/en_TC/en_TC.go
@@ -233,3 +233,79 @@ func (en *en_TC) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_TC'
+// 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 (en *en_TC) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_TK/en_TK.go b/en_TK/en_TK.go
index 4baf32a3..4e93c6ba 100644
--- a/en_TK/en_TK.go
+++ b/en_TK/en_TK.go
@@ -233,3 +233,79 @@ func (en *en_TK) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_TK'
+// 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 (en *en_TK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_TO/en_TO.go b/en_TO/en_TO.go
index f9b37451..259ca389 100644
--- a/en_TO/en_TO.go
+++ b/en_TO/en_TO.go
@@ -76,8 +76,8 @@ func (en *en_TO) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (en *en_TO) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod10 := math.Mod(n, 10)
nMod100 := math.Mod(n, 100)
+ nMod10 := math.Mod(n, 10)
if nMod10 == 1 && nMod100 != 11 {
return locales.PluralRuleOne
@@ -233,3 +233,79 @@ func (en *en_TO) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_TO'
+// 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 (en *en_TO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_TT/en_TT.go b/en_TT/en_TT.go
index 22faee80..d6c58b00 100644
--- a/en_TT/en_TT.go
+++ b/en_TT/en_TT.go
@@ -76,8 +76,8 @@ func (en *en_TT) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (en *en_TT) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod10 := math.Mod(n, 10)
nMod100 := math.Mod(n, 100)
+ nMod10 := math.Mod(n, 10)
if nMod10 == 1 && nMod100 != 11 {
return locales.PluralRuleOne
@@ -233,3 +233,79 @@ func (en *en_TT) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_TT'
+// 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 (en *en_TT) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_TV/en_TV.go b/en_TV/en_TV.go
index 6234ca81..9a3ebda5 100644
--- a/en_TV/en_TV.go
+++ b/en_TV/en_TV.go
@@ -233,3 +233,79 @@ func (en *en_TV) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_TV'
+// 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 (en *en_TV) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_TZ/en_TZ.go b/en_TZ/en_TZ.go
index d93246d4..5ad63d0a 100644
--- a/en_TZ/en_TZ.go
+++ b/en_TZ/en_TZ.go
@@ -233,3 +233,79 @@ func (en *en_TZ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_TZ'
+// 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 (en *en_TZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_UG/en_UG.go b/en_UG/en_UG.go
index 9609d9ad..66eae102 100644
--- a/en_UG/en_UG.go
+++ b/en_UG/en_UG.go
@@ -76,8 +76,8 @@ func (en *en_UG) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (en *en_UG) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod100 := math.Mod(n, 100)
nMod10 := math.Mod(n, 10)
+ nMod100 := math.Mod(n, 100)
if nMod10 == 1 && nMod100 != 11 {
return locales.PluralRuleOne
@@ -233,3 +233,79 @@ func (en *en_UG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_UG'
+// 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 (en *en_UG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_UM/en_UM.go b/en_UM/en_UM.go
index 8a3aa809..97172b40 100644
--- a/en_UM/en_UM.go
+++ b/en_UM/en_UM.go
@@ -233,3 +233,79 @@ func (en *en_UM) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_UM'
+// 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 (en *en_UM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_US/en_US.go b/en_US/en_US.go
index 9bce4d1c..dd02231b 100644
--- a/en_US/en_US.go
+++ b/en_US/en_US.go
@@ -233,3 +233,79 @@ func (en *en_US) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_US'
+// 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 (en *en_US) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_US_POSIX/en_US_POSIX.go b/en_US_POSIX/en_US_POSIX.go
index 12f11317..f94e5505 100644
--- a/en_US_POSIX/en_US_POSIX.go
+++ b/en_US_POSIX/en_US_POSIX.go
@@ -213,3 +213,67 @@ func (en *en_US_POSIX) FmtCurrency(num float64, v uint64, currency currency.Type
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_US_POSIX'
+// 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 (en *en_US_POSIX) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ b = append(b, en.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/en_VC/en_VC.go b/en_VC/en_VC.go
index 23eaf0ef..c3d0bc5e 100644
--- a/en_VC/en_VC.go
+++ b/en_VC/en_VC.go
@@ -233,3 +233,79 @@ func (en *en_VC) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_VC'
+// 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 (en *en_VC) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_VG/en_VG.go b/en_VG/en_VG.go
index ff03847b..fbe2f74b 100644
--- a/en_VG/en_VG.go
+++ b/en_VG/en_VG.go
@@ -233,3 +233,79 @@ func (en *en_VG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_VG'
+// 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 (en *en_VG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_VI/en_VI.go b/en_VI/en_VI.go
index d982dbf4..13ea14a5 100644
--- a/en_VI/en_VI.go
+++ b/en_VI/en_VI.go
@@ -233,3 +233,79 @@ func (en *en_VI) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_VI'
+// 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 (en *en_VI) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_VU/en_VU.go b/en_VU/en_VU.go
index ae1aab5c..2790da10 100644
--- a/en_VU/en_VU.go
+++ b/en_VU/en_VU.go
@@ -233,3 +233,79 @@ func (en *en_VU) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_VU'
+// 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 (en *en_VU) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_WS/en_WS.go b/en_WS/en_WS.go
index 864d82b1..977a2613 100644
--- a/en_WS/en_WS.go
+++ b/en_WS/en_WS.go
@@ -233,3 +233,79 @@ func (en *en_WS) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_WS'
+// 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 (en *en_WS) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_ZA/en_ZA.go b/en_ZA/en_ZA.go
index ca3885da..e5618a54 100644
--- a/en_ZA/en_ZA.go
+++ b/en_ZA/en_ZA.go
@@ -76,8 +76,8 @@ func (en *en_ZA) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (en *en_ZA) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod100 := math.Mod(n, 100)
nMod10 := math.Mod(n, 10)
+ nMod100 := math.Mod(n, 100)
if nMod10 == 1 && nMod100 != 11 {
return locales.PluralRuleOne
@@ -239,3 +239,82 @@ func (en *en_ZA) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_ZA'
+// 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 (en *en_ZA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(en.group) - 1; j >= 0; j-- {
+ b = append(b, en.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_ZM/en_ZM.go b/en_ZM/en_ZM.go
index 4e512b7b..a0e29e75 100644
--- a/en_ZM/en_ZM.go
+++ b/en_ZM/en_ZM.go
@@ -233,3 +233,79 @@ func (en *en_ZM) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_ZM'
+// 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 (en *en_ZM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/en_ZW/en_ZW.go b/en_ZW/en_ZW.go
index fff4c4fb..a1c6ea7a 100644
--- a/en_ZW/en_ZW.go
+++ b/en_ZW/en_ZW.go
@@ -233,3 +233,79 @@ func (en *en_ZW) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'en_ZW'
+// 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 (en *en_ZW) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := en.currencies[currency]
+ l := len(s) + len(en.decimal) + len(en.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, en.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, en.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(en.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, en.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, en.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, en.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/eo/eo.go b/eo/eo.go
index 2ab51a06..fea53eb0 100644
--- a/eo/eo.go
+++ b/eo/eo.go
@@ -215,3 +215,68 @@ func (eo *eo) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'eo'
+// 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 (eo *eo) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := eo.currencies[currency]
+ l := len(s) + len(eo.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, eo.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(eo.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, eo.currencyNegativePrefix[j])
+ }
+
+ for j := len(eo.minus) - 1; j >= 0; j-- {
+ b = append(b, eo.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(eo.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, eo.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, eo.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, eo.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/eo_001/eo_001.go b/eo_001/eo_001.go
index c51839b6..f955a33c 100644
--- a/eo_001/eo_001.go
+++ b/eo_001/eo_001.go
@@ -215,3 +215,68 @@ func (eo *eo_001) FmtCurrency(num float64, v uint64, currency currency.Type) []b
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'eo_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 (eo *eo_001) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := eo.currencies[currency]
+ l := len(s) + len(eo.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, eo.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(eo.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, eo.currencyNegativePrefix[j])
+ }
+
+ for j := len(eo.minus) - 1; j >= 0; j-- {
+ b = append(b, eo.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(eo.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, eo.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, eo.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, eo.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/es/es.go b/es/es.go
index 2e3ed1e0..a4d1f029 100644
--- a/es/es.go
+++ b/es/es.go
@@ -223,3 +223,75 @@ func (es *es) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es'
+// 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 (es *es) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, es.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, es.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/es_419/es_419.go b/es_419/es_419.go
index 43a3fc98..4b099979 100644
--- a/es_419/es_419.go
+++ b/es_419/es_419.go
@@ -219,3 +219,71 @@ func (es *es_419) FmtCurrency(num float64, v uint64, currency currency.Type) []b
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_419'
+// 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 (es *es_419) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, es.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/es_AR/es_AR.go b/es_AR/es_AR.go
index 584dd2f7..0a8ce6d8 100644
--- a/es_AR/es_AR.go
+++ b/es_AR/es_AR.go
@@ -229,3 +229,83 @@ func (es *es_AR) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_AR'
+// 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 (es *es_AR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(es.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, es.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(es.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, es.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/es_BO/es_BO.go b/es_BO/es_BO.go
index 6989bb9d..77297bbb 100644
--- a/es_BO/es_BO.go
+++ b/es_BO/es_BO.go
@@ -223,3 +223,75 @@ func (es *es_BO) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_BO'
+// 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 (es *es_BO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, es.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, es.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/es_BR/es_BR.go b/es_BR/es_BR.go
index ea4b1778..bca73cad 100644
--- a/es_BR/es_BR.go
+++ b/es_BR/es_BR.go
@@ -223,3 +223,75 @@ func (es *es_BR) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_BR'
+// 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 (es *es_BR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, es.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, es.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/es_CL/es_CL.go b/es_CL/es_CL.go
index 4b435fee..a4495005 100644
--- a/es_CL/es_CL.go
+++ b/es_CL/es_CL.go
@@ -219,3 +219,71 @@ func (es *es_CL) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_CL'
+// 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 (es *es_CL) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, es.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/es_CO/es_CO.go b/es_CO/es_CO.go
index 76623c28..1e7dba94 100644
--- a/es_CO/es_CO.go
+++ b/es_CO/es_CO.go
@@ -223,3 +223,79 @@ func (es *es_CO) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_CO'
+// 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 (es *es_CO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(es.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, es.currencyNegativePrefix[j])
+ }
+
+ b = append(b, es.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(es.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, es.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/es_CR/es_CR.go b/es_CR/es_CR.go
index 8be917a0..d893ba57 100644
--- a/es_CR/es_CR.go
+++ b/es_CR/es_CR.go
@@ -229,3 +229,78 @@ func (es *es_CR) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_CR'
+// 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 (es *es_CR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(es.group) - 1; j >= 0; j-- {
+ b = append(b, es.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, es.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, es.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/es_CU/es_CU.go b/es_CU/es_CU.go
index f75f7e65..40a80c6f 100644
--- a/es_CU/es_CU.go
+++ b/es_CU/es_CU.go
@@ -223,3 +223,75 @@ func (es *es_CU) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_CU'
+// 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 (es *es_CU) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, es.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, es.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/es_DO/es_DO.go b/es_DO/es_DO.go
index 526bf019..18307725 100644
--- a/es_DO/es_DO.go
+++ b/es_DO/es_DO.go
@@ -221,3 +221,81 @@ func (es *es_DO) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_DO'
+// 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 (es *es_DO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, es.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, es.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/es_EA/es_EA.go b/es_EA/es_EA.go
index ffe91c5e..9614bde3 100644
--- a/es_EA/es_EA.go
+++ b/es_EA/es_EA.go
@@ -223,3 +223,75 @@ func (es *es_EA) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_EA'
+// 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 (es *es_EA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, es.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, es.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/es_EC/es_EC.go b/es_EC/es_EC.go
index c4125cb4..24888dc4 100644
--- a/es_EC/es_EC.go
+++ b/es_EC/es_EC.go
@@ -219,3 +219,71 @@ func (es *es_EC) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_EC'
+// 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 (es *es_EC) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, es.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/es_ES/es_ES.go b/es_ES/es_ES.go
index e497950e..a1b827aa 100644
--- a/es_ES/es_ES.go
+++ b/es_ES/es_ES.go
@@ -223,3 +223,75 @@ func (es *es_ES) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_ES'
+// 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 (es *es_ES) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, es.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, es.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/es_GQ/es_GQ.go b/es_GQ/es_GQ.go
index 3df32ec2..a9935d9d 100644
--- a/es_GQ/es_GQ.go
+++ b/es_GQ/es_GQ.go
@@ -219,3 +219,71 @@ func (es *es_GQ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_GQ'
+// 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 (es *es_GQ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, es.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/es_GT/es_GT.go b/es_GT/es_GT.go
index c8c7b4a1..2b2b681c 100644
--- a/es_GT/es_GT.go
+++ b/es_GT/es_GT.go
@@ -202,3 +202,58 @@ func (es *es_GT) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_GT'
+// 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 (es *es_GT) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, es.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, es.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/es_HN/es_HN.go b/es_HN/es_HN.go
index 53fa4500..833dc954 100644
--- a/es_HN/es_HN.go
+++ b/es_HN/es_HN.go
@@ -223,3 +223,75 @@ func (es *es_HN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_HN'
+// 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 (es *es_HN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, es.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, es.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/es_IC/es_IC.go b/es_IC/es_IC.go
index 116cf86b..51424c2c 100644
--- a/es_IC/es_IC.go
+++ b/es_IC/es_IC.go
@@ -223,3 +223,75 @@ func (es *es_IC) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_IC'
+// 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 (es *es_IC) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, es.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, es.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/es_MX/es_MX.go b/es_MX/es_MX.go
index 5503f01f..fcd4775f 100644
--- a/es_MX/es_MX.go
+++ b/es_MX/es_MX.go
@@ -219,3 +219,75 @@ func (es *es_MX) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_MX'
+// 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 (es *es_MX) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, es.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, es.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/es_NI/es_NI.go b/es_NI/es_NI.go
index 6ae50503..808990f0 100644
--- a/es_NI/es_NI.go
+++ b/es_NI/es_NI.go
@@ -223,3 +223,75 @@ func (es *es_NI) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_NI'
+// 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 (es *es_NI) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, es.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, es.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/es_PA/es_PA.go b/es_PA/es_PA.go
index 4b14e0fc..dd01509b 100644
--- a/es_PA/es_PA.go
+++ b/es_PA/es_PA.go
@@ -223,3 +223,75 @@ func (es *es_PA) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_PA'
+// 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 (es *es_PA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, es.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, es.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/es_PE/es_PE.go b/es_PE/es_PE.go
index 2dcbd3ca..ebe05c4c 100644
--- a/es_PE/es_PE.go
+++ b/es_PE/es_PE.go
@@ -223,3 +223,75 @@ func (es *es_PE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_PE'
+// 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 (es *es_PE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, es.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, es.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/es_PH/es_PH.go b/es_PH/es_PH.go
index 31a64503..779e509f 100644
--- a/es_PH/es_PH.go
+++ b/es_PH/es_PH.go
@@ -223,3 +223,75 @@ func (es *es_PH) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_PH'
+// 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 (es *es_PH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, es.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, es.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/es_PR/es_PR.go b/es_PR/es_PR.go
index af34c990..dce40a3a 100644
--- a/es_PR/es_PR.go
+++ b/es_PR/es_PR.go
@@ -223,3 +223,75 @@ func (es *es_PR) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_PR'
+// 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 (es *es_PR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, es.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, es.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/es_PY/es_PY.go b/es_PY/es_PY.go
index 29a91015..f9716c14 100644
--- a/es_PY/es_PY.go
+++ b/es_PY/es_PY.go
@@ -227,3 +227,79 @@ func (es *es_PY) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_PY'
+// 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 (es *es_PY) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(es.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, es.currencyNegativePrefix[j])
+ }
+
+ b = append(b, es.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(es.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, es.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/es_SV/es_SV.go b/es_SV/es_SV.go
index 0c5a930e..6376e791 100644
--- a/es_SV/es_SV.go
+++ b/es_SV/es_SV.go
@@ -223,3 +223,75 @@ func (es *es_SV) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_SV'
+// 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 (es *es_SV) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, es.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, es.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/es_US/es_US.go b/es_US/es_US.go
index 5cbefc17..6b9cc858 100644
--- a/es_US/es_US.go
+++ b/es_US/es_US.go
@@ -223,3 +223,75 @@ func (es *es_US) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_US'
+// 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 (es *es_US) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, es.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, es.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/es_UY/es_UY.go b/es_UY/es_UY.go
index 8ccc3dfe..38771eab 100644
--- a/es_UY/es_UY.go
+++ b/es_UY/es_UY.go
@@ -229,3 +229,83 @@ func (es *es_UY) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_UY'
+// 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 (es *es_UY) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(es.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, es.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(es.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, es.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, es.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/es_VE/es_VE.go b/es_VE/es_VE.go
index 144dcdba..d1c90869 100644
--- a/es_VE/es_VE.go
+++ b/es_VE/es_VE.go
@@ -219,3 +219,71 @@ func (es *es_VE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'es_VE'
+// 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 (es *es_VE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := es.currencies[currency]
+ l := len(s) + len(es.decimal) + len(es.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, es.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, es.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, es.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, es.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/et/et.go b/et/et.go
index f52ee008..7cb91cbf 100644
--- a/et/et.go
+++ b/et/et.go
@@ -234,3 +234,80 @@ func (et *et) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'et'
+// 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 (et *et) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := et.currencies[currency]
+ l := len(s) + len(et.decimal) + len(et.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, et.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(et.group) - 1; j >= 0; j-- {
+ b = append(b, et.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(et.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, et.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, et.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, et.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, et.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/et_EE/et_EE.go b/et_EE/et_EE.go
index 4afff1cd..bda158ee 100644
--- a/et_EE/et_EE.go
+++ b/et_EE/et_EE.go
@@ -234,3 +234,80 @@ func (et *et_EE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'et_EE'
+// 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 (et *et_EE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := et.currencies[currency]
+ l := len(s) + len(et.decimal) + len(et.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, et.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(et.group) - 1; j >= 0; j-- {
+ b = append(b, et.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(et.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, et.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, et.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, et.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, et.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/eu/eu.go b/eu/eu.go
index 9a421901..827168a6 100644
--- a/eu/eu.go
+++ b/eu/eu.go
@@ -239,3 +239,77 @@ func (eu *eu) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'eu'
+// 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 (eu *eu) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := eu.currencies[currency]
+ l := len(s) + len(eu.decimal) + len(eu.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, eu.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, eu.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(eu.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, eu.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, eu.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, eu.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, eu.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/eu_ES/eu_ES.go b/eu_ES/eu_ES.go
index cd061d47..66183c76 100644
--- a/eu_ES/eu_ES.go
+++ b/eu_ES/eu_ES.go
@@ -239,3 +239,77 @@ func (eu *eu_ES) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'eu_ES'
+// 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 (eu *eu_ES) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := eu.currencies[currency]
+ l := len(s) + len(eu.decimal) + len(eu.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, eu.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, eu.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(eu.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, eu.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, eu.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, eu.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, eu.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ewo/ewo.go b/ewo/ewo.go
index 7d492a43..e8d004b8 100644
--- a/ewo/ewo.go
+++ b/ewo/ewo.go
@@ -224,3 +224,80 @@ func (ewo *ewo) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ewo'
+// 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 (ewo *ewo) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ewo.currencies[currency]
+ l := len(s) + len(ewo.decimal) + len(ewo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ewo.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ewo.group) - 1; j >= 0; j-- {
+ b = append(b, ewo.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ewo.minus) - 1; j >= 0; j-- {
+ b = append(b, ewo.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ewo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ewo.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ewo.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ewo_CM/ewo_CM.go b/ewo_CM/ewo_CM.go
index 61e1894e..b11a92ef 100644
--- a/ewo_CM/ewo_CM.go
+++ b/ewo_CM/ewo_CM.go
@@ -224,3 +224,80 @@ func (ewo *ewo_CM) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ewo_CM'
+// 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 (ewo *ewo_CM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ewo.currencies[currency]
+ l := len(s) + len(ewo.decimal) + len(ewo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ewo.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ewo.group) - 1; j >= 0; j-- {
+ b = append(b, ewo.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ewo.minus) - 1; j >= 0; j-- {
+ b = append(b, ewo.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ewo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ewo.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ewo.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fa/fa.go b/fa/fa.go
index 4654a20c..7d33f96c 100644
--- a/fa/fa.go
+++ b/fa/fa.go
@@ -245,3 +245,87 @@ func (fa *fa) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fa'
+// 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 (fa *fa) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fa.currencies[currency]
+ l := len(s) + len(fa.decimal) + len(fa.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fa.decimal) - 1; j >= 0; j-- {
+ b = append(b, fa.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fa.group) - 1; j >= 0; j-- {
+ b = append(b, fa.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(fa.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fa.currencyNegativePrefix[j])
+ }
+
+ for j := len(fa.minus) - 1; j >= 0; j-- {
+ b = append(b, fa.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(fa.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, fa.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fa.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/fa_AF/fa_AF.go b/fa_AF/fa_AF.go
index 3887b6b3..5b29ac07 100644
--- a/fa_AF/fa_AF.go
+++ b/fa_AF/fa_AF.go
@@ -245,3 +245,87 @@ func (fa *fa_AF) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fa_AF'
+// 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 (fa *fa_AF) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fa.currencies[currency]
+ l := len(s) + len(fa.decimal) + len(fa.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fa.decimal) - 1; j >= 0; j-- {
+ b = append(b, fa.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fa.group) - 1; j >= 0; j-- {
+ b = append(b, fa.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(fa.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fa.currencyNegativePrefix[j])
+ }
+
+ for j := len(fa.minus) - 1; j >= 0; j-- {
+ b = append(b, fa.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(fa.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, fa.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fa.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/fa_IR/fa_IR.go b/fa_IR/fa_IR.go
index 990039e4..422b4dca 100644
--- a/fa_IR/fa_IR.go
+++ b/fa_IR/fa_IR.go
@@ -245,3 +245,87 @@ func (fa *fa_IR) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fa_IR'
+// 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 (fa *fa_IR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fa.currencies[currency]
+ l := len(s) + len(fa.decimal) + len(fa.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fa.decimal) - 1; j >= 0; j-- {
+ b = append(b, fa.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fa.group) - 1; j >= 0; j-- {
+ b = append(b, fa.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(fa.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fa.currencyNegativePrefix[j])
+ }
+
+ for j := len(fa.minus) - 1; j >= 0; j-- {
+ b = append(b, fa.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(fa.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, fa.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fa.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ff/ff.go b/ff/ff.go
index 2848ffdc..b44187a8 100644
--- a/ff/ff.go
+++ b/ff/ff.go
@@ -165,3 +165,80 @@ func (ff *ff) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ff'
+// 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 (ff *ff) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ff.currencies[currency]
+ l := len(s) + len(ff.decimal) + len(ff.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ff.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ff.group) - 1; j >= 0; j-- {
+ b = append(b, ff.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ff.minus) - 1; j >= 0; j-- {
+ b = append(b, ff.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ff.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ff.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ff.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ff_CM/ff_CM.go b/ff_CM/ff_CM.go
index c06f1029..0269e4bb 100644
--- a/ff_CM/ff_CM.go
+++ b/ff_CM/ff_CM.go
@@ -165,3 +165,80 @@ func (ff *ff_CM) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ff_CM'
+// 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 (ff *ff_CM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ff.currencies[currency]
+ l := len(s) + len(ff.decimal) + len(ff.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ff.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ff.group) - 1; j >= 0; j-- {
+ b = append(b, ff.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ff.minus) - 1; j >= 0; j-- {
+ b = append(b, ff.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ff.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ff.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ff.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ff_GN/ff_GN.go b/ff_GN/ff_GN.go
index fcc5ccd3..cdf0582c 100644
--- a/ff_GN/ff_GN.go
+++ b/ff_GN/ff_GN.go
@@ -165,3 +165,80 @@ func (ff *ff_GN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ff_GN'
+// 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 (ff *ff_GN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ff.currencies[currency]
+ l := len(s) + len(ff.decimal) + len(ff.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ff.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ff.group) - 1; j >= 0; j-- {
+ b = append(b, ff.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ff.minus) - 1; j >= 0; j-- {
+ b = append(b, ff.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ff.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ff.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ff.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ff_MR/ff_MR.go b/ff_MR/ff_MR.go
index 9f2428b6..52a851e7 100644
--- a/ff_MR/ff_MR.go
+++ b/ff_MR/ff_MR.go
@@ -165,3 +165,80 @@ func (ff *ff_MR) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ff_MR'
+// 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 (ff *ff_MR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ff.currencies[currency]
+ l := len(s) + len(ff.decimal) + len(ff.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ff.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ff.group) - 1; j >= 0; j-- {
+ b = append(b, ff.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ff.minus) - 1; j >= 0; j-- {
+ b = append(b, ff.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ff.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ff.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ff.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ff_SN/ff_SN.go b/ff_SN/ff_SN.go
index 5605e5e8..726c551f 100644
--- a/ff_SN/ff_SN.go
+++ b/ff_SN/ff_SN.go
@@ -165,3 +165,80 @@ func (ff *ff_SN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ff_SN'
+// 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 (ff *ff_SN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ff.currencies[currency]
+ l := len(s) + len(ff.decimal) + len(ff.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ff.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ff.group) - 1; j >= 0; j-- {
+ b = append(b, ff.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ff.minus) - 1; j >= 0; j-- {
+ b = append(b, ff.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ff.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ff.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ff.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fi/fi.go b/fi/fi.go
index 99b9626a..47d3e8a3 100644
--- a/fi/fi.go
+++ b/fi/fi.go
@@ -236,3 +236,80 @@ func (fi *fi) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fi'
+// 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 (fi *fi) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fi.currencies[currency]
+ l := len(s) + len(fi.decimal) + len(fi.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, fi.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fi.group) - 1; j >= 0; j-- {
+ b = append(b, fi.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fi.minus) - 1; j >= 0; j-- {
+ b = append(b, fi.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fi.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fi.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fi.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fi_FI/fi_FI.go b/fi_FI/fi_FI.go
index bf231eac..fa3de3ca 100644
--- a/fi_FI/fi_FI.go
+++ b/fi_FI/fi_FI.go
@@ -236,3 +236,80 @@ func (fi *fi_FI) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fi_FI'
+// 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 (fi *fi_FI) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fi.currencies[currency]
+ l := len(s) + len(fi.decimal) + len(fi.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, fi.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fi.group) - 1; j >= 0; j-- {
+ b = append(b, fi.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fi.minus) - 1; j >= 0; j-- {
+ b = append(b, fi.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fi.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fi.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fi.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fil/fil.go b/fil/fil.go
index 3e34e7c3..d73845b5 100644
--- a/fil/fil.go
+++ b/fil/fil.go
@@ -243,3 +243,79 @@ func (fil *fil) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fil'
+// 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 (fil *fil) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fil.currencies[currency]
+ l := len(s) + len(fil.decimal) + len(fil.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, fil.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, fil.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(fil.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fil.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fil.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fil.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/fil_PH/fil_PH.go b/fil_PH/fil_PH.go
index 62ca3b79..b7b34171 100644
--- a/fil_PH/fil_PH.go
+++ b/fil_PH/fil_PH.go
@@ -243,3 +243,79 @@ func (fil *fil_PH) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fil_PH'
+// 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 (fil *fil_PH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fil.currencies[currency]
+ l := len(s) + len(fil.decimal) + len(fil.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, fil.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, fil.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(fil.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fil.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fil.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fil.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/fo/fo.go b/fo/fo.go
index a0217143..a82f976e 100644
--- a/fo/fo.go
+++ b/fo/fo.go
@@ -231,3 +231,77 @@ func (fo *fo) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fo'
+// 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 (fo *fo) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fo.currencies[currency]
+ l := len(s) + len(fo.decimal) + len(fo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, fo.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, fo.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fo.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fo.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fo.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fo.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fo_DK/fo_DK.go b/fo_DK/fo_DK.go
index c56b1970..d8352de8 100644
--- a/fo_DK/fo_DK.go
+++ b/fo_DK/fo_DK.go
@@ -231,3 +231,77 @@ func (fo *fo_DK) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fo_DK'
+// 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 (fo *fo_DK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fo.currencies[currency]
+ l := len(s) + len(fo.decimal) + len(fo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, fo.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, fo.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fo.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fo.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fo.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fo.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fo_FO/fo_FO.go b/fo_FO/fo_FO.go
index ea5f750d..4d6d6909 100644
--- a/fo_FO/fo_FO.go
+++ b/fo_FO/fo_FO.go
@@ -231,3 +231,77 @@ func (fo *fo_FO) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fo_FO'
+// 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 (fo *fo_FO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fo.currencies[currency]
+ l := len(s) + len(fo.decimal) + len(fo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, fo.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, fo.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fo.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fo.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fo.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fo.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr/fr.go b/fr/fr.go
index 7f4706fd..7bd38db1 100644
--- a/fr/fr.go
+++ b/fr/fr.go
@@ -265,3 +265,83 @@ func (fr *fr) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr'
+// 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 (fr *fr) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_BE/fr_BE.go b/fr_BE/fr_BE.go
index 1c80e726..43cfd849 100644
--- a/fr_BE/fr_BE.go
+++ b/fr_BE/fr_BE.go
@@ -259,3 +259,80 @@ func (fr *fr_BE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_BE'
+// 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 (fr *fr_BE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, fr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_BF/fr_BF.go b/fr_BF/fr_BF.go
index 2eb2bf8a..086d1671 100644
--- a/fr_BF/fr_BF.go
+++ b/fr_BF/fr_BF.go
@@ -265,3 +265,83 @@ func (fr *fr_BF) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_BF'
+// 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 (fr *fr_BF) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_BI/fr_BI.go b/fr_BI/fr_BI.go
index 27b7ad5e..b2f6c5c5 100644
--- a/fr_BI/fr_BI.go
+++ b/fr_BI/fr_BI.go
@@ -265,3 +265,83 @@ func (fr *fr_BI) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_BI'
+// 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 (fr *fr_BI) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_BJ/fr_BJ.go b/fr_BJ/fr_BJ.go
index 13e53a9d..0dd4f4b3 100644
--- a/fr_BJ/fr_BJ.go
+++ b/fr_BJ/fr_BJ.go
@@ -265,3 +265,83 @@ func (fr *fr_BJ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_BJ'
+// 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 (fr *fr_BJ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_BL/fr_BL.go b/fr_BL/fr_BL.go
index 9fab5d7a..e515525c 100644
--- a/fr_BL/fr_BL.go
+++ b/fr_BL/fr_BL.go
@@ -265,3 +265,83 @@ func (fr *fr_BL) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_BL'
+// 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 (fr *fr_BL) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_CA/fr_CA.go b/fr_CA/fr_CA.go
index ba601356..ec423977 100644
--- a/fr_CA/fr_CA.go
+++ b/fr_CA/fr_CA.go
@@ -237,3 +237,57 @@ func (fr *fr_CA) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_CA'
+// 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 (fr *fr_CA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.minus) - 1; j >= 0; j-- {
+ b = append(b, fr.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_CD/fr_CD.go b/fr_CD/fr_CD.go
index 0caebc02..bef48f92 100644
--- a/fr_CD/fr_CD.go
+++ b/fr_CD/fr_CD.go
@@ -265,3 +265,83 @@ func (fr *fr_CD) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_CD'
+// 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 (fr *fr_CD) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_CF/fr_CF.go b/fr_CF/fr_CF.go
index 973498f2..d647f98c 100644
--- a/fr_CF/fr_CF.go
+++ b/fr_CF/fr_CF.go
@@ -265,3 +265,83 @@ func (fr *fr_CF) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_CF'
+// 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 (fr *fr_CF) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_CG/fr_CG.go b/fr_CG/fr_CG.go
index 12da4e51..ee186aa9 100644
--- a/fr_CG/fr_CG.go
+++ b/fr_CG/fr_CG.go
@@ -265,3 +265,83 @@ func (fr *fr_CG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_CG'
+// 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 (fr *fr_CG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_CH/fr_CH.go b/fr_CH/fr_CH.go
index 58c2e65e..ef5e4aed 100644
--- a/fr_CH/fr_CH.go
+++ b/fr_CH/fr_CH.go
@@ -254,3 +254,84 @@ func (fr *fr_CH) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_CH'
+// 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 (fr *fr_CH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, fr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ for j := len(fr.minus) - 1; j >= 0; j-- {
+ b = append(b, fr.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(fr.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/fr_CI/fr_CI.go b/fr_CI/fr_CI.go
index 257f6ea5..9275426f 100644
--- a/fr_CI/fr_CI.go
+++ b/fr_CI/fr_CI.go
@@ -265,3 +265,83 @@ func (fr *fr_CI) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_CI'
+// 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 (fr *fr_CI) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_CM/fr_CM.go b/fr_CM/fr_CM.go
index 31f5aa8e..feb8d1e4 100644
--- a/fr_CM/fr_CM.go
+++ b/fr_CM/fr_CM.go
@@ -265,3 +265,83 @@ func (fr *fr_CM) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_CM'
+// 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 (fr *fr_CM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_DJ/fr_DJ.go b/fr_DJ/fr_DJ.go
index 8b835914..e0a175fb 100644
--- a/fr_DJ/fr_DJ.go
+++ b/fr_DJ/fr_DJ.go
@@ -265,3 +265,83 @@ func (fr *fr_DJ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_DJ'
+// 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 (fr *fr_DJ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_DZ/fr_DZ.go b/fr_DZ/fr_DZ.go
index c5e39c7c..916e623b 100644
--- a/fr_DZ/fr_DZ.go
+++ b/fr_DZ/fr_DZ.go
@@ -265,3 +265,83 @@ func (fr *fr_DZ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_DZ'
+// 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 (fr *fr_DZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_FR/fr_FR.go b/fr_FR/fr_FR.go
index 3e230d50..d0b22134 100644
--- a/fr_FR/fr_FR.go
+++ b/fr_FR/fr_FR.go
@@ -265,3 +265,83 @@ func (fr *fr_FR) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_FR'
+// 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 (fr *fr_FR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_GA/fr_GA.go b/fr_GA/fr_GA.go
index 5c0bd0f0..676e5f08 100644
--- a/fr_GA/fr_GA.go
+++ b/fr_GA/fr_GA.go
@@ -265,3 +265,83 @@ func (fr *fr_GA) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_GA'
+// 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 (fr *fr_GA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_GF/fr_GF.go b/fr_GF/fr_GF.go
index 7ff13bc9..2b7960b3 100644
--- a/fr_GF/fr_GF.go
+++ b/fr_GF/fr_GF.go
@@ -265,3 +265,83 @@ func (fr *fr_GF) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_GF'
+// 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 (fr *fr_GF) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_GN/fr_GN.go b/fr_GN/fr_GN.go
index 0233b7b9..1fcc3706 100644
--- a/fr_GN/fr_GN.go
+++ b/fr_GN/fr_GN.go
@@ -265,3 +265,83 @@ func (fr *fr_GN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_GN'
+// 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 (fr *fr_GN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_GP/fr_GP.go b/fr_GP/fr_GP.go
index 05ede39b..16c1f744 100644
--- a/fr_GP/fr_GP.go
+++ b/fr_GP/fr_GP.go
@@ -265,3 +265,83 @@ func (fr *fr_GP) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_GP'
+// 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 (fr *fr_GP) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_GQ/fr_GQ.go b/fr_GQ/fr_GQ.go
index 3df2eb1a..b8a1e8fb 100644
--- a/fr_GQ/fr_GQ.go
+++ b/fr_GQ/fr_GQ.go
@@ -265,3 +265,83 @@ func (fr *fr_GQ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_GQ'
+// 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 (fr *fr_GQ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_HT/fr_HT.go b/fr_HT/fr_HT.go
index f6eb7d9e..df6eabc9 100644
--- a/fr_HT/fr_HT.go
+++ b/fr_HT/fr_HT.go
@@ -265,3 +265,83 @@ func (fr *fr_HT) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_HT'
+// 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 (fr *fr_HT) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_KM/fr_KM.go b/fr_KM/fr_KM.go
index f0a3afed..0c3b4a61 100644
--- a/fr_KM/fr_KM.go
+++ b/fr_KM/fr_KM.go
@@ -265,3 +265,83 @@ func (fr *fr_KM) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_KM'
+// 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 (fr *fr_KM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_LU/fr_LU.go b/fr_LU/fr_LU.go
index 5f625572..365bad3c 100644
--- a/fr_LU/fr_LU.go
+++ b/fr_LU/fr_LU.go
@@ -259,3 +259,80 @@ func (fr *fr_LU) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_LU'
+// 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 (fr *fr_LU) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, fr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_MA/fr_MA.go b/fr_MA/fr_MA.go
index 4a8adc22..06931b5d 100644
--- a/fr_MA/fr_MA.go
+++ b/fr_MA/fr_MA.go
@@ -259,3 +259,80 @@ func (fr *fr_MA) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_MA'
+// 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 (fr *fr_MA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, fr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_MC/fr_MC.go b/fr_MC/fr_MC.go
index c4cebbac..bb84dda2 100644
--- a/fr_MC/fr_MC.go
+++ b/fr_MC/fr_MC.go
@@ -265,3 +265,83 @@ func (fr *fr_MC) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_MC'
+// 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 (fr *fr_MC) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_MF/fr_MF.go b/fr_MF/fr_MF.go
index 161d05b2..abcadacb 100644
--- a/fr_MF/fr_MF.go
+++ b/fr_MF/fr_MF.go
@@ -265,3 +265,83 @@ func (fr *fr_MF) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_MF'
+// 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 (fr *fr_MF) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_MG/fr_MG.go b/fr_MG/fr_MG.go
index 5c9d3830..72ae490c 100644
--- a/fr_MG/fr_MG.go
+++ b/fr_MG/fr_MG.go
@@ -265,3 +265,83 @@ func (fr *fr_MG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_MG'
+// 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 (fr *fr_MG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_ML/fr_ML.go b/fr_ML/fr_ML.go
index 4d9b6767..436cd68b 100644
--- a/fr_ML/fr_ML.go
+++ b/fr_ML/fr_ML.go
@@ -265,3 +265,83 @@ func (fr *fr_ML) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_ML'
+// 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 (fr *fr_ML) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_MQ/fr_MQ.go b/fr_MQ/fr_MQ.go
index 1abd7efb..cb28df8d 100644
--- a/fr_MQ/fr_MQ.go
+++ b/fr_MQ/fr_MQ.go
@@ -265,3 +265,83 @@ func (fr *fr_MQ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_MQ'
+// 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 (fr *fr_MQ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_MR/fr_MR.go b/fr_MR/fr_MR.go
index c564f441..9039a4f3 100644
--- a/fr_MR/fr_MR.go
+++ b/fr_MR/fr_MR.go
@@ -265,3 +265,83 @@ func (fr *fr_MR) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_MR'
+// 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 (fr *fr_MR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_MU/fr_MU.go b/fr_MU/fr_MU.go
index 113b630d..77b15715 100644
--- a/fr_MU/fr_MU.go
+++ b/fr_MU/fr_MU.go
@@ -265,3 +265,83 @@ func (fr *fr_MU) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_MU'
+// 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 (fr *fr_MU) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_NC/fr_NC.go b/fr_NC/fr_NC.go
index 8f5024eb..618865f0 100644
--- a/fr_NC/fr_NC.go
+++ b/fr_NC/fr_NC.go
@@ -265,3 +265,83 @@ func (fr *fr_NC) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_NC'
+// 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 (fr *fr_NC) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_NE/fr_NE.go b/fr_NE/fr_NE.go
index 0c1c0443..459775e2 100644
--- a/fr_NE/fr_NE.go
+++ b/fr_NE/fr_NE.go
@@ -265,3 +265,83 @@ func (fr *fr_NE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_NE'
+// 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 (fr *fr_NE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_PF/fr_PF.go b/fr_PF/fr_PF.go
index 82bd3265..f6c44e0a 100644
--- a/fr_PF/fr_PF.go
+++ b/fr_PF/fr_PF.go
@@ -265,3 +265,83 @@ func (fr *fr_PF) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_PF'
+// 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 (fr *fr_PF) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_PM/fr_PM.go b/fr_PM/fr_PM.go
index ffc63323..0f0d6b3c 100644
--- a/fr_PM/fr_PM.go
+++ b/fr_PM/fr_PM.go
@@ -265,3 +265,83 @@ func (fr *fr_PM) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_PM'
+// 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 (fr *fr_PM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_RE/fr_RE.go b/fr_RE/fr_RE.go
index ffdaac15..2b1e701f 100644
--- a/fr_RE/fr_RE.go
+++ b/fr_RE/fr_RE.go
@@ -265,3 +265,83 @@ func (fr *fr_RE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_RE'
+// 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 (fr *fr_RE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_RW/fr_RW.go b/fr_RW/fr_RW.go
index abcca4c2..d0c3ca42 100644
--- a/fr_RW/fr_RW.go
+++ b/fr_RW/fr_RW.go
@@ -265,3 +265,83 @@ func (fr *fr_RW) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_RW'
+// 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 (fr *fr_RW) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_SC/fr_SC.go b/fr_SC/fr_SC.go
index 08a2be9e..30de1d2d 100644
--- a/fr_SC/fr_SC.go
+++ b/fr_SC/fr_SC.go
@@ -265,3 +265,83 @@ func (fr *fr_SC) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_SC'
+// 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 (fr *fr_SC) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_SN/fr_SN.go b/fr_SN/fr_SN.go
index d769bfdf..28dc0413 100644
--- a/fr_SN/fr_SN.go
+++ b/fr_SN/fr_SN.go
@@ -265,3 +265,83 @@ func (fr *fr_SN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_SN'
+// 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 (fr *fr_SN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_SY/fr_SY.go b/fr_SY/fr_SY.go
index 86e47ace..405c51e7 100644
--- a/fr_SY/fr_SY.go
+++ b/fr_SY/fr_SY.go
@@ -265,3 +265,83 @@ func (fr *fr_SY) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_SY'
+// 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 (fr *fr_SY) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_TD/fr_TD.go b/fr_TD/fr_TD.go
index e3943bec..a46ef2d2 100644
--- a/fr_TD/fr_TD.go
+++ b/fr_TD/fr_TD.go
@@ -265,3 +265,83 @@ func (fr *fr_TD) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_TD'
+// 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 (fr *fr_TD) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_TG/fr_TG.go b/fr_TG/fr_TG.go
index 53502e5e..1e0b691e 100644
--- a/fr_TG/fr_TG.go
+++ b/fr_TG/fr_TG.go
@@ -265,3 +265,83 @@ func (fr *fr_TG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_TG'
+// 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 (fr *fr_TG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_TN/fr_TN.go b/fr_TN/fr_TN.go
index f4f84bd7..9426ef54 100644
--- a/fr_TN/fr_TN.go
+++ b/fr_TN/fr_TN.go
@@ -265,3 +265,83 @@ func (fr *fr_TN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_TN'
+// 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 (fr *fr_TN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_VU/fr_VU.go b/fr_VU/fr_VU.go
index 90d59a7f..2e37ddc6 100644
--- a/fr_VU/fr_VU.go
+++ b/fr_VU/fr_VU.go
@@ -265,3 +265,83 @@ func (fr *fr_VU) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_VU'
+// 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 (fr *fr_VU) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_WF/fr_WF.go b/fr_WF/fr_WF.go
index 601f64a0..d36faee4 100644
--- a/fr_WF/fr_WF.go
+++ b/fr_WF/fr_WF.go
@@ -265,3 +265,83 @@ func (fr *fr_WF) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_WF'
+// 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 (fr *fr_WF) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fr_YT/fr_YT.go b/fr_YT/fr_YT.go
index dff77e6c..7a7d0999 100644
--- a/fr_YT/fr_YT.go
+++ b/fr_YT/fr_YT.go
@@ -265,3 +265,83 @@ func (fr *fr_YT) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fr_YT'
+// 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 (fr *fr_YT) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fr.currencies[currency]
+ l := len(s) + len(fr.decimal) + len(fr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(fr.decimal) - 1; j >= 0; j-- {
+ b = append(b, fr.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(fr.group) - 1; j >= 0; j-- {
+ b = append(b, fr.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(fr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, fr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/fur/fur.go b/fur/fur.go
index bf36e0a4..493f8fd5 100644
--- a/fur/fur.go
+++ b/fur/fur.go
@@ -223,3 +223,79 @@ func (fur *fur) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fur'
+// 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 (fur *fur) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fur.currencies[currency]
+ l := len(s) + len(fur.decimal) + len(fur.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, fur.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, fur.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(fur.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fur.currencyNegativePrefix[j])
+ }
+
+ b = append(b, fur.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(fur.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, fur.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fur.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/fur_IT/fur_IT.go b/fur_IT/fur_IT.go
index 8c50afcc..bcfa534f 100644
--- a/fur_IT/fur_IT.go
+++ b/fur_IT/fur_IT.go
@@ -223,3 +223,79 @@ func (fur *fur_IT) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fur_IT'
+// 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 (fur *fur_IT) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fur.currencies[currency]
+ l := len(s) + len(fur.decimal) + len(fur.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, fur.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, fur.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(fur.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fur.currencyNegativePrefix[j])
+ }
+
+ b = append(b, fur.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(fur.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, fur.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fur.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/fy/fy.go b/fy/fy.go
index edd25143..a5251ce6 100644
--- a/fy/fy.go
+++ b/fy/fy.go
@@ -226,3 +226,83 @@ func (fy *fy) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fy'
+// 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 (fy *fy) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fy.currencies[currency]
+ l := len(s) + len(fy.decimal) + len(fy.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, fy.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, fy.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(fy.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fy.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(fy.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, fy.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fy.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fy.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/fy_NL/fy_NL.go b/fy_NL/fy_NL.go
index 6ea22d2a..3cce89a4 100644
--- a/fy_NL/fy_NL.go
+++ b/fy_NL/fy_NL.go
@@ -226,3 +226,83 @@ func (fy *fy_NL) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'fy_NL'
+// 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 (fy *fy_NL) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := fy.currencies[currency]
+ l := len(s) + len(fy.decimal) + len(fy.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, fy.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, fy.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(fy.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, fy.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(fy.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, fy.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, fy.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, fy.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ga/ga.go b/ga/ga.go
index 63e384a6..92406399 100644
--- a/ga/ga.go
+++ b/ga/ga.go
@@ -232,3 +232,79 @@ func (ga *ga) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ga'
+// 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 (ga *ga) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ga.currencies[currency]
+ l := len(s) + len(ga.decimal) + len(ga.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ga.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ga.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ga.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ga.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ga.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ga.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ga_IE/ga_IE.go b/ga_IE/ga_IE.go
index 21afd03e..6986d2de 100644
--- a/ga_IE/ga_IE.go
+++ b/ga_IE/ga_IE.go
@@ -232,3 +232,79 @@ func (ga *ga_IE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ga_IE'
+// 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 (ga *ga_IE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ga.currencies[currency]
+ l := len(s) + len(ga.decimal) + len(ga.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ga.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ga.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ga.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ga.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ga.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ga.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/gd/gd.go b/gd/gd.go
index 38fee79f..ead04d20 100644
--- a/gd/gd.go
+++ b/gd/gd.go
@@ -244,3 +244,85 @@ func (gd *gd) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'gd'
+// 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 (gd *gd) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := gd.currencies[currency]
+ l := len(s) + len(gd.decimal) + len(gd.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(gd.decimal) - 1; j >= 0; j-- {
+ b = append(b, gd.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(gd.group) - 1; j >= 0; j-- {
+ b = append(b, gd.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(gd.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, gd.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, gd.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, gd.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/gd_GB/gd_GB.go b/gd_GB/gd_GB.go
index 41ba790e..8d053ee9 100644
--- a/gd_GB/gd_GB.go
+++ b/gd_GB/gd_GB.go
@@ -244,3 +244,85 @@ func (gd *gd_GB) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'gd_GB'
+// 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 (gd *gd_GB) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := gd.currencies[currency]
+ l := len(s) + len(gd.decimal) + len(gd.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(gd.decimal) - 1; j >= 0; j-- {
+ b = append(b, gd.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(gd.group) - 1; j >= 0; j-- {
+ b = append(b, gd.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(gd.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, gd.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, gd.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, gd.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/gl/gl.go b/gl/gl.go
index 4760ccd4..ec2c7170 100644
--- a/gl/gl.go
+++ b/gl/gl.go
@@ -231,3 +231,75 @@ func (gl *gl) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'gl'
+// 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 (gl *gl) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := gl.currencies[currency]
+ l := len(s) + len(gl.decimal) + len(gl.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, gl.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, gl.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, gl.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, gl.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, gl.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, gl.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/gl_ES/gl_ES.go b/gl_ES/gl_ES.go
index 2b35b16d..e8755ba2 100644
--- a/gl_ES/gl_ES.go
+++ b/gl_ES/gl_ES.go
@@ -231,3 +231,75 @@ func (gl *gl_ES) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'gl_ES'
+// 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 (gl *gl_ES) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := gl.currencies[currency]
+ l := len(s) + len(gl.decimal) + len(gl.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, gl.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, gl.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, gl.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, gl.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, gl.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, gl.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/gsw/gsw.go b/gsw/gsw.go
index c8d1981e..88d83d2d 100644
--- a/gsw/gsw.go
+++ b/gsw/gsw.go
@@ -235,3 +235,80 @@ func (gsw *gsw) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'gsw'
+// 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 (gsw *gsw) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := gsw.currencies[currency]
+ l := len(s) + len(gsw.decimal) + len(gsw.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, gsw.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(gsw.group) - 1; j >= 0; j-- {
+ b = append(b, gsw.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(gsw.minus) - 1; j >= 0; j-- {
+ b = append(b, gsw.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, gsw.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, gsw.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, gsw.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/gsw_CH/gsw_CH.go b/gsw_CH/gsw_CH.go
index fcc71c68..dd1264bd 100644
--- a/gsw_CH/gsw_CH.go
+++ b/gsw_CH/gsw_CH.go
@@ -235,3 +235,80 @@ func (gsw *gsw_CH) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'gsw_CH'
+// 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 (gsw *gsw_CH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := gsw.currencies[currency]
+ l := len(s) + len(gsw.decimal) + len(gsw.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, gsw.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(gsw.group) - 1; j >= 0; j-- {
+ b = append(b, gsw.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(gsw.minus) - 1; j >= 0; j-- {
+ b = append(b, gsw.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, gsw.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, gsw.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, gsw.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/gsw_FR/gsw_FR.go b/gsw_FR/gsw_FR.go
index cbac7dc6..c9e9988c 100644
--- a/gsw_FR/gsw_FR.go
+++ b/gsw_FR/gsw_FR.go
@@ -235,3 +235,80 @@ func (gsw *gsw_FR) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'gsw_FR'
+// 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 (gsw *gsw_FR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := gsw.currencies[currency]
+ l := len(s) + len(gsw.decimal) + len(gsw.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, gsw.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(gsw.group) - 1; j >= 0; j-- {
+ b = append(b, gsw.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(gsw.minus) - 1; j >= 0; j-- {
+ b = append(b, gsw.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, gsw.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, gsw.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, gsw.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/gsw_LI/gsw_LI.go b/gsw_LI/gsw_LI.go
index 2b8526d5..1ee5e3a8 100644
--- a/gsw_LI/gsw_LI.go
+++ b/gsw_LI/gsw_LI.go
@@ -235,3 +235,80 @@ func (gsw *gsw_LI) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'gsw_LI'
+// 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 (gsw *gsw_LI) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := gsw.currencies[currency]
+ l := len(s) + len(gsw.decimal) + len(gsw.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, gsw.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(gsw.group) - 1; j >= 0; j-- {
+ b = append(b, gsw.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(gsw.minus) - 1; j >= 0; j-- {
+ b = append(b, gsw.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, gsw.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, gsw.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, gsw.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/gu/gu.go b/gu/gu.go
index 04cd7d9f..1bd67f6a 100644
--- a/gu/gu.go
+++ b/gu/gu.go
@@ -283,3 +283,94 @@ func (gu *gu) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'gu'
+// 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 (gu *gu) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := gu.currencies[currency]
+ l := len(s) + len(gu.decimal) + len(gu.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(gu.decimal) - 1; j >= 0; j-- {
+ b = append(b, gu.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ for j := len(gu.group) - 1; j >= 0; j-- {
+ b = append(b, gu.group[j])
+ }
+
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(gu.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, gu.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, gu.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, gu.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/gu_IN/gu_IN.go b/gu_IN/gu_IN.go
index 0f6fe073..d9099714 100644
--- a/gu_IN/gu_IN.go
+++ b/gu_IN/gu_IN.go
@@ -283,3 +283,94 @@ func (gu *gu_IN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'gu_IN'
+// 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 (gu *gu_IN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := gu.currencies[currency]
+ l := len(s) + len(gu.decimal) + len(gu.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(gu.decimal) - 1; j >= 0; j-- {
+ b = append(b, gu.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ for j := len(gu.group) - 1; j >= 0; j-- {
+ b = append(b, gu.group[j])
+ }
+
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(gu.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, gu.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, gu.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, gu.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/guz/guz.go b/guz/guz.go
index 6877439e..8c169a0a 100644
--- a/guz/guz.go
+++ b/guz/guz.go
@@ -160,3 +160,85 @@ func (guz *guz) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'guz'
+// 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 (guz *guz) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := guz.currencies[currency]
+ l := len(s) + len(guz.decimal) + len(guz.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(guz.decimal) - 1; j >= 0; j-- {
+ b = append(b, guz.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(guz.group) - 1; j >= 0; j-- {
+ b = append(b, guz.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(guz.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, guz.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, guz.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, guz.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/guz_KE/guz_KE.go b/guz_KE/guz_KE.go
index 2ef946f0..4899a1d8 100644
--- a/guz_KE/guz_KE.go
+++ b/guz_KE/guz_KE.go
@@ -160,3 +160,85 @@ func (guz *guz_KE) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'guz_KE'
+// 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 (guz *guz_KE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := guz.currencies[currency]
+ l := len(s) + len(guz.decimal) + len(guz.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(guz.decimal) - 1; j >= 0; j-- {
+ b = append(b, guz.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(guz.group) - 1; j >= 0; j-- {
+ b = append(b, guz.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(guz.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, guz.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, guz.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, guz.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/gv/gv.go b/gv/gv.go
index 8d18d8cb..e7825912 100644
--- a/gv/gv.go
+++ b/gv/gv.go
@@ -172,3 +172,79 @@ func (gv *gv) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'gv'
+// 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 (gv *gv) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := gv.currencies[currency]
+ l := len(s) + len(gv.decimal) + len(gv.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(gv.decimal) - 1; j >= 0; j-- {
+ b = append(b, gv.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(gv.group) - 1; j >= 0; j-- {
+ b = append(b, gv.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(gv.minus) - 1; j >= 0; j-- {
+ b = append(b, gv.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, gv.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/gv_IM/gv_IM.go b/gv_IM/gv_IM.go
index 4efd477c..49e6afd9 100644
--- a/gv_IM/gv_IM.go
+++ b/gv_IM/gv_IM.go
@@ -172,3 +172,79 @@ func (gv *gv_IM) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'gv_IM'
+// 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 (gv *gv_IM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := gv.currencies[currency]
+ l := len(s) + len(gv.decimal) + len(gv.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(gv.decimal) - 1; j >= 0; j-- {
+ b = append(b, gv.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(gv.group) - 1; j >= 0; j-- {
+ b = append(b, gv.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(gv.minus) - 1; j >= 0; j-- {
+ b = append(b, gv.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, gv.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ha/ha.go b/ha/ha.go
index 33e41c14..2b633ac5 100644
--- a/ha/ha.go
+++ b/ha/ha.go
@@ -229,3 +229,81 @@ func (ha *ha) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ha'
+// 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 (ha *ha) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ha.currencies[currency]
+ l := len(s) + len(ha.decimal) + len(ha.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ha.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ha.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ha.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ha.currencyNegativePrefix[j])
+ }
+
+ for j := len(ha.minus) - 1; j >= 0; j-- {
+ b = append(b, ha.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ha.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ha.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ha.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ha_GH/ha_GH.go b/ha_GH/ha_GH.go
index 374f2746..4fa72102 100644
--- a/ha_GH/ha_GH.go
+++ b/ha_GH/ha_GH.go
@@ -229,3 +229,81 @@ func (ha *ha_GH) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ha_GH'
+// 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 (ha *ha_GH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ha.currencies[currency]
+ l := len(s) + len(ha.decimal) + len(ha.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ha.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ha.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ha.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ha.currencyNegativePrefix[j])
+ }
+
+ for j := len(ha.minus) - 1; j >= 0; j-- {
+ b = append(b, ha.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ha.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ha.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ha.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ha_NE/ha_NE.go b/ha_NE/ha_NE.go
index 67b30be0..551f4ba8 100644
--- a/ha_NE/ha_NE.go
+++ b/ha_NE/ha_NE.go
@@ -229,3 +229,81 @@ func (ha *ha_NE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ha_NE'
+// 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 (ha *ha_NE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ha.currencies[currency]
+ l := len(s) + len(ha.decimal) + len(ha.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ha.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ha.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ha.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ha.currencyNegativePrefix[j])
+ }
+
+ for j := len(ha.minus) - 1; j >= 0; j-- {
+ b = append(b, ha.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ha.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ha.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ha.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ha_NG/ha_NG.go b/ha_NG/ha_NG.go
index 20484c94..fc99f7d4 100644
--- a/ha_NG/ha_NG.go
+++ b/ha_NG/ha_NG.go
@@ -229,3 +229,81 @@ func (ha *ha_NG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ha_NG'
+// 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 (ha *ha_NG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ha.currencies[currency]
+ l := len(s) + len(ha.decimal) + len(ha.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ha.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ha.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ha.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ha.currencyNegativePrefix[j])
+ }
+
+ for j := len(ha.minus) - 1; j >= 0; j-- {
+ b = append(b, ha.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ha.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ha.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ha.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/haw/haw.go b/haw/haw.go
index 801d8cf7..65619057 100644
--- a/haw/haw.go
+++ b/haw/haw.go
@@ -167,3 +167,85 @@ func (haw *haw) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'haw'
+// 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 (haw *haw) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := haw.currencies[currency]
+ l := len(s) + len(haw.decimal) + len(haw.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(haw.decimal) - 1; j >= 0; j-- {
+ b = append(b, haw.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(haw.group) - 1; j >= 0; j-- {
+ b = append(b, haw.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(haw.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, haw.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, haw.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, haw.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/haw_US/haw_US.go b/haw_US/haw_US.go
index 6938881a..c0e06758 100644
--- a/haw_US/haw_US.go
+++ b/haw_US/haw_US.go
@@ -167,3 +167,85 @@ func (haw *haw_US) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'haw_US'
+// 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 (haw *haw_US) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := haw.currencies[currency]
+ l := len(s) + len(haw.decimal) + len(haw.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(haw.decimal) - 1; j >= 0; j-- {
+ b = append(b, haw.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(haw.group) - 1; j >= 0; j-- {
+ b = append(b, haw.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(haw.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, haw.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, haw.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, haw.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/he/he.go b/he/he.go
index 8badaa0f..5b9184e2 100644
--- a/he/he.go
+++ b/he/he.go
@@ -258,3 +258,77 @@ func (he *he) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'he'
+// 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 (he *he) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := he.currencies[currency]
+ l := len(s) + len(he.decimal) + len(he.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, he.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, he.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(he.minus) - 1; j >= 0; j-- {
+ b = append(b, he.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, he.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, he.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, he.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/he_IL/he_IL.go b/he_IL/he_IL.go
index 04b3cc6b..d840c135 100644
--- a/he_IL/he_IL.go
+++ b/he_IL/he_IL.go
@@ -258,3 +258,77 @@ func (he *he_IL) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'he_IL'
+// 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 (he *he_IL) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := he.currencies[currency]
+ l := len(s) + len(he.decimal) + len(he.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, he.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, he.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(he.minus) - 1; j >= 0; j-- {
+ b = append(b, he.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, he.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, he.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, he.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/hi/hi.go b/hi/hi.go
index 8acfa4c2..f7a9a977 100644
--- a/hi/hi.go
+++ b/hi/hi.go
@@ -258,3 +258,80 @@ func (hi *hi) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'hi'
+// 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 (hi *hi) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := hi.currencies[currency]
+ l := len(s) + len(hi.decimal) + len(hi.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, hi.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ b = append(b, hi.group[0])
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, hi.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, hi.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/hi_IN/hi_IN.go b/hi_IN/hi_IN.go
index 17baa2b5..f03fb8d6 100644
--- a/hi_IN/hi_IN.go
+++ b/hi_IN/hi_IN.go
@@ -258,3 +258,80 @@ func (hi *hi_IN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'hi_IN'
+// 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 (hi *hi_IN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := hi.currencies[currency]
+ l := len(s) + len(hi.decimal) + len(hi.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, hi.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ b = append(b, hi.group[0])
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, hi.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, hi.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/hr/hr.go b/hr/hr.go
index 067c7196..dada36d1 100644
--- a/hr/hr.go
+++ b/hr/hr.go
@@ -250,3 +250,75 @@ func (hr *hr) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'hr'
+// 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 (hr *hr) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := hr.currencies[currency]
+ l := len(s) + len(hr.decimal) + len(hr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, hr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, hr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, hr.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, hr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, hr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, hr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/hr_BA/hr_BA.go b/hr_BA/hr_BA.go
index 927fdc83..9c3f484e 100644
--- a/hr_BA/hr_BA.go
+++ b/hr_BA/hr_BA.go
@@ -250,3 +250,75 @@ func (hr *hr_BA) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'hr_BA'
+// 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 (hr *hr_BA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := hr.currencies[currency]
+ l := len(s) + len(hr.decimal) + len(hr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, hr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, hr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, hr.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, hr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, hr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, hr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/hr_HR/hr_HR.go b/hr_HR/hr_HR.go
index 998de9c1..c1f8b436 100644
--- a/hr_HR/hr_HR.go
+++ b/hr_HR/hr_HR.go
@@ -250,3 +250,75 @@ func (hr *hr_HR) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'hr_HR'
+// 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 (hr *hr_HR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := hr.currencies[currency]
+ l := len(s) + len(hr.decimal) + len(hr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, hr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, hr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, hr.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, hr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, hr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, hr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/hsb/hsb.go b/hsb/hsb.go
index e6376bea..2ca1a5ae 100644
--- a/hsb/hsb.go
+++ b/hsb/hsb.go
@@ -231,3 +231,75 @@ func (hsb *hsb) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'hsb'
+// 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 (hsb *hsb) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := hsb.currencies[currency]
+ l := len(s) + len(hsb.decimal) + len(hsb.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, hsb.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, hsb.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, hsb.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, hsb.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, hsb.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, hsb.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/hsb_DE/hsb_DE.go b/hsb_DE/hsb_DE.go
index 52294463..51e4325a 100644
--- a/hsb_DE/hsb_DE.go
+++ b/hsb_DE/hsb_DE.go
@@ -231,3 +231,75 @@ func (hsb *hsb_DE) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'hsb_DE'
+// 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 (hsb *hsb_DE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := hsb.currencies[currency]
+ l := len(s) + len(hsb.decimal) + len(hsb.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, hsb.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, hsb.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, hsb.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, hsb.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, hsb.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, hsb.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/hu/hu.go b/hu/hu.go
index 30a6a0f4..7eda49f7 100644
--- a/hu/hu.go
+++ b/hu/hu.go
@@ -243,3 +243,78 @@ func (hu *hu) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'hu'
+// 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 (hu *hu) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := hu.currencies[currency]
+ l := len(s) + len(hu.decimal) + len(hu.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, hu.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(hu.group) - 1; j >= 0; j-- {
+ b = append(b, hu.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, hu.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, hu.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, hu.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, hu.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/hu_HU/hu_HU.go b/hu_HU/hu_HU.go
index 0884583f..76c641b8 100644
--- a/hu_HU/hu_HU.go
+++ b/hu_HU/hu_HU.go
@@ -243,3 +243,78 @@ func (hu *hu_HU) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'hu_HU'
+// 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 (hu *hu_HU) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := hu.currencies[currency]
+ l := len(s) + len(hu.decimal) + len(hu.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, hu.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(hu.group) - 1; j >= 0; j-- {
+ b = append(b, hu.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, hu.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, hu.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, hu.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, hu.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/hy/hy.go b/hy/hy.go
index c9be7558..b48ba73d 100644
--- a/hy/hy.go
+++ b/hy/hy.go
@@ -230,3 +230,79 @@ func (hy *hy) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'hy'
+// 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 (hy *hy) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := hy.currencies[currency]
+ l := len(s) + len(hy.decimal) + len(hy.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, hy.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, hy.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(hy.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, hy.currencyNegativePrefix[j])
+ }
+
+ b = append(b, hy.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(hy.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, hy.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, hy.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/hy_AM/hy_AM.go b/hy_AM/hy_AM.go
index 58c9877a..3b42adc5 100644
--- a/hy_AM/hy_AM.go
+++ b/hy_AM/hy_AM.go
@@ -230,3 +230,79 @@ func (hy *hy_AM) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'hy_AM'
+// 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 (hy *hy_AM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := hy.currencies[currency]
+ l := len(s) + len(hy.decimal) + len(hy.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, hy.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, hy.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(hy.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, hy.currencyNegativePrefix[j])
+ }
+
+ b = append(b, hy.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(hy.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, hy.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, hy.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/id/id.go b/id/id.go
index fd134827..1ba46ba5 100644
--- a/id/id.go
+++ b/id/id.go
@@ -208,3 +208,71 @@ func (id *id) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'id'
+// 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 (id *id) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := id.currencies[currency]
+ l := len(s) + len(id.decimal) + len(id.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, id.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, id.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, id.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, id.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/id_ID/id_ID.go b/id_ID/id_ID.go
index 459f60be..b001c5ad 100644
--- a/id_ID/id_ID.go
+++ b/id_ID/id_ID.go
@@ -208,3 +208,71 @@ func (id *id_ID) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'id_ID'
+// 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 (id *id_ID) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := id.currencies[currency]
+ l := len(s) + len(id.decimal) + len(id.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, id.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, id.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, id.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, id.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ig/ig.go b/ig/ig.go
index 2579aae0..3980ab01 100644
--- a/ig/ig.go
+++ b/ig/ig.go
@@ -160,3 +160,85 @@ func (ig *ig) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ig'
+// 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 (ig *ig) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ig.currencies[currency]
+ l := len(s) + len(ig.decimal) + len(ig.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ig.decimal) - 1; j >= 0; j-- {
+ b = append(b, ig.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ig.group) - 1; j >= 0; j-- {
+ b = append(b, ig.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ig.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ig.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ig.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ig.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ig_NG/ig_NG.go b/ig_NG/ig_NG.go
index 802e9a87..817bd4e3 100644
--- a/ig_NG/ig_NG.go
+++ b/ig_NG/ig_NG.go
@@ -160,3 +160,85 @@ func (ig *ig_NG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ig_NG'
+// 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 (ig *ig_NG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ig.currencies[currency]
+ l := len(s) + len(ig.decimal) + len(ig.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ig.decimal) - 1; j >= 0; j-- {
+ b = append(b, ig.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ig.group) - 1; j >= 0; j-- {
+ b = append(b, ig.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ig.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ig.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ig.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ig.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ii/ii.go b/ii/ii.go
index c6d82fd9..d45a1a1a 100644
--- a/ii/ii.go
+++ b/ii/ii.go
@@ -141,3 +141,68 @@ func (ii *ii) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ii'
+// 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 (ii *ii) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ii.currencies[currency]
+ l := len(s) + len(ii.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ii.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ii.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ii.currencyNegativePrefix[j])
+ }
+
+ for j := len(ii.minus) - 1; j >= 0; j-- {
+ b = append(b, ii.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ii.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ii.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, ii.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, ii.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ii_CN/ii_CN.go b/ii_CN/ii_CN.go
index 371abbc5..1bdfdc63 100644
--- a/ii_CN/ii_CN.go
+++ b/ii_CN/ii_CN.go
@@ -141,3 +141,68 @@ func (ii *ii_CN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ii_CN'
+// 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 (ii *ii_CN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ii.currencies[currency]
+ l := len(s) + len(ii.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ii.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ii.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ii.currencyNegativePrefix[j])
+ }
+
+ for j := len(ii.minus) - 1; j >= 0; j-- {
+ b = append(b, ii.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ii.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ii.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, ii.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, ii.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/is/is.go b/is/is.go
index a71c219e..5c470c4c 100644
--- a/is/is.go
+++ b/is/is.go
@@ -236,3 +236,75 @@ func (is *is) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'is'
+// 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 (is *is) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := is.currencies[currency]
+ l := len(s) + len(is.decimal) + len(is.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, is.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, is.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, is.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, is.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, is.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, is.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/is_IS/is_IS.go b/is_IS/is_IS.go
index 18d64859..9a757543 100644
--- a/is_IS/is_IS.go
+++ b/is_IS/is_IS.go
@@ -236,3 +236,75 @@ func (is *is_IS) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'is_IS'
+// 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 (is *is_IS) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := is.currencies[currency]
+ l := len(s) + len(is.decimal) + len(is.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, is.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, is.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, is.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, is.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, is.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, is.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/it/it.go b/it/it.go
index e99f95ab..ed7f9ef6 100644
--- a/it/it.go
+++ b/it/it.go
@@ -238,3 +238,75 @@ func (it *it) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'it'
+// 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 (it *it) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := it.currencies[currency]
+ l := len(s) + len(it.decimal) + len(it.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, it.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, it.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, it.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, it.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, it.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, it.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/it_CH/it_CH.go b/it_CH/it_CH.go
index fb779f27..15f985ed 100644
--- a/it_CH/it_CH.go
+++ b/it_CH/it_CH.go
@@ -242,3 +242,79 @@ func (it *it_CH) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'it_CH'
+// 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 (it *it_CH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := it.currencies[currency]
+ l := len(s) + len(it.decimal) + len(it.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, it.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, it.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(it.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, it.currencyNegativePrefix[j])
+ }
+
+ b = append(b, it.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(it.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, it.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, it.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/it_IT/it_IT.go b/it_IT/it_IT.go
index 5be2c126..df799507 100644
--- a/it_IT/it_IT.go
+++ b/it_IT/it_IT.go
@@ -238,3 +238,75 @@ func (it *it_IT) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'it_IT'
+// 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 (it *it_IT) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := it.currencies[currency]
+ l := len(s) + len(it.decimal) + len(it.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, it.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, it.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, it.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, it.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, it.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, it.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/it_SM/it_SM.go b/it_SM/it_SM.go
index e46e8d24..e2cc2b76 100644
--- a/it_SM/it_SM.go
+++ b/it_SM/it_SM.go
@@ -238,3 +238,75 @@ func (it *it_SM) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'it_SM'
+// 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 (it *it_SM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := it.currencies[currency]
+ l := len(s) + len(it.decimal) + len(it.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, it.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, it.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, it.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, it.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, it.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, it.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ja/ja.go b/ja/ja.go
index 27249e7b..1921bfcd 100644
--- a/ja/ja.go
+++ b/ja/ja.go
@@ -212,3 +212,79 @@ func (ja *ja) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ja'
+// 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 (ja *ja) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ja.currencies[currency]
+ l := len(s) + len(ja.decimal) + len(ja.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ja.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ja.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ja.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ja.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ja.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ja.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ja_JP/ja_JP.go b/ja_JP/ja_JP.go
index dcf12be8..ae6c8247 100644
--- a/ja_JP/ja_JP.go
+++ b/ja_JP/ja_JP.go
@@ -212,3 +212,79 @@ func (ja *ja_JP) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ja_JP'
+// 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 (ja *ja_JP) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ja.currencies[currency]
+ l := len(s) + len(ja.decimal) + len(ja.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ja.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ja.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ja.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ja.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ja.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ja.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/jgo/jgo.go b/jgo/jgo.go
index 447a3cd8..34a79b0c 100644
--- a/jgo/jgo.go
+++ b/jgo/jgo.go
@@ -223,3 +223,79 @@ func (jgo *jgo) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'jgo'
+// 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 (jgo *jgo) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := jgo.currencies[currency]
+ l := len(s) + len(jgo.decimal) + len(jgo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, jgo.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, jgo.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(jgo.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, jgo.currencyNegativePrefix[j])
+ }
+
+ b = append(b, jgo.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(jgo.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, jgo.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, jgo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/jgo_CM/jgo_CM.go b/jgo_CM/jgo_CM.go
index 5678724a..04a19236 100644
--- a/jgo_CM/jgo_CM.go
+++ b/jgo_CM/jgo_CM.go
@@ -223,3 +223,79 @@ func (jgo *jgo_CM) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'jgo_CM'
+// 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 (jgo *jgo_CM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := jgo.currencies[currency]
+ l := len(s) + len(jgo.decimal) + len(jgo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, jgo.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, jgo.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(jgo.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, jgo.currencyNegativePrefix[j])
+ }
+
+ b = append(b, jgo.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(jgo.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, jgo.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, jgo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/jmc/jmc.go b/jmc/jmc.go
index bc0055d6..b3fbe269 100644
--- a/jmc/jmc.go
+++ b/jmc/jmc.go
@@ -163,3 +163,79 @@ func (jmc *jmc) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'jmc'
+// 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 (jmc *jmc) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := jmc.currencies[currency]
+ l := len(s) + len(jmc.decimal) + len(jmc.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(jmc.decimal) - 1; j >= 0; j-- {
+ b = append(b, jmc.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(jmc.group) - 1; j >= 0; j-- {
+ b = append(b, jmc.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(jmc.minus) - 1; j >= 0; j-- {
+ b = append(b, jmc.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, jmc.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/jmc_TZ/jmc_TZ.go b/jmc_TZ/jmc_TZ.go
index 04f77a86..ed7b635f 100644
--- a/jmc_TZ/jmc_TZ.go
+++ b/jmc_TZ/jmc_TZ.go
@@ -163,3 +163,79 @@ func (jmc *jmc_TZ) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'jmc_TZ'
+// 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 (jmc *jmc_TZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := jmc.currencies[currency]
+ l := len(s) + len(jmc.decimal) + len(jmc.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(jmc.decimal) - 1; j >= 0; j-- {
+ b = append(b, jmc.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(jmc.group) - 1; j >= 0; j-- {
+ b = append(b, jmc.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(jmc.minus) - 1; j >= 0; j-- {
+ b = append(b, jmc.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, jmc.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ka/ka.go b/ka/ka.go
index 2fd3e013..6caf8d55 100644
--- a/ka/ka.go
+++ b/ka/ka.go
@@ -251,3 +251,78 @@ func (ka *ka) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ka'
+// 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 (ka *ka) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ka.currencies[currency]
+ l := len(s) + len(ka.decimal) + len(ka.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ka.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ka.group) - 1; j >= 0; j-- {
+ b = append(b, ka.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, ka.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ka.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ka.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ka.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ka_GE/ka_GE.go b/ka_GE/ka_GE.go
index b60c17ee..008cbcec 100644
--- a/ka_GE/ka_GE.go
+++ b/ka_GE/ka_GE.go
@@ -251,3 +251,78 @@ func (ka *ka_GE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ka_GE'
+// 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 (ka *ka_GE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ka.currencies[currency]
+ l := len(s) + len(ka.decimal) + len(ka.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ka.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ka.group) - 1; j >= 0; j-- {
+ b = append(b, ka.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, ka.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ka.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ka.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ka.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/kab/kab.go b/kab/kab.go
index 389e5814..ad4695b7 100644
--- a/kab/kab.go
+++ b/kab/kab.go
@@ -159,3 +159,76 @@ func (kab *kab) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kab'
+// 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 (kab *kab) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kab.currencies[currency]
+ l := len(s) + len(kab.decimal) + len(kab.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, kab.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(kab.group) - 1; j >= 0; j-- {
+ b = append(b, kab.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(kab.minus) - 1; j >= 0; j-- {
+ b = append(b, kab.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, kab.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/kab_DZ/kab_DZ.go b/kab_DZ/kab_DZ.go
index 8a6d43dc..cb113685 100644
--- a/kab_DZ/kab_DZ.go
+++ b/kab_DZ/kab_DZ.go
@@ -159,3 +159,76 @@ func (kab *kab_DZ) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kab_DZ'
+// 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 (kab *kab_DZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kab.currencies[currency]
+ l := len(s) + len(kab.decimal) + len(kab.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, kab.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(kab.group) - 1; j >= 0; j-- {
+ b = append(b, kab.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(kab.minus) - 1; j >= 0; j-- {
+ b = append(b, kab.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, kab.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/kam/kam.go b/kam/kam.go
index 927ebc05..badabe5f 100644
--- a/kam/kam.go
+++ b/kam/kam.go
@@ -160,3 +160,85 @@ func (kam *kam) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kam'
+// 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 (kam *kam) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kam.currencies[currency]
+ l := len(s) + len(kam.decimal) + len(kam.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(kam.decimal) - 1; j >= 0; j-- {
+ b = append(b, kam.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(kam.group) - 1; j >= 0; j-- {
+ b = append(b, kam.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(kam.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, kam.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, kam.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, kam.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/kam_KE/kam_KE.go b/kam_KE/kam_KE.go
index ad2d7d9f..bc596bf3 100644
--- a/kam_KE/kam_KE.go
+++ b/kam_KE/kam_KE.go
@@ -160,3 +160,85 @@ func (kam *kam_KE) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kam_KE'
+// 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 (kam *kam_KE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kam.currencies[currency]
+ l := len(s) + len(kam.decimal) + len(kam.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(kam.decimal) - 1; j >= 0; j-- {
+ b = append(b, kam.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(kam.group) - 1; j >= 0; j-- {
+ b = append(b, kam.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(kam.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, kam.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, kam.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, kam.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/kde/kde.go b/kde/kde.go
index 58cf7be7..b3c7417d 100644
--- a/kde/kde.go
+++ b/kde/kde.go
@@ -160,3 +160,85 @@ func (kde *kde) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kde'
+// 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 (kde *kde) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kde.currencies[currency]
+ l := len(s) + len(kde.decimal) + len(kde.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(kde.decimal) - 1; j >= 0; j-- {
+ b = append(b, kde.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(kde.group) - 1; j >= 0; j-- {
+ b = append(b, kde.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(kde.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, kde.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, kde.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, kde.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/kde_TZ/kde_TZ.go b/kde_TZ/kde_TZ.go
index 328e5531..e021aa80 100644
--- a/kde_TZ/kde_TZ.go
+++ b/kde_TZ/kde_TZ.go
@@ -160,3 +160,85 @@ func (kde *kde_TZ) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kde_TZ'
+// 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 (kde *kde_TZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kde.currencies[currency]
+ l := len(s) + len(kde.decimal) + len(kde.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(kde.decimal) - 1; j >= 0; j-- {
+ b = append(b, kde.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(kde.group) - 1; j >= 0; j-- {
+ b = append(b, kde.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(kde.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, kde.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, kde.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, kde.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/kea/kea.go b/kea/kea.go
index bf7042b9..3cbb5a2a 100644
--- a/kea/kea.go
+++ b/kea/kea.go
@@ -220,3 +220,80 @@ func (kea *kea) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kea'
+// 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 (kea *kea) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kea.currencies[currency]
+ l := len(s) + len(kea.decimal) + len(kea.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, kea.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(kea.group) - 1; j >= 0; j-- {
+ b = append(b, kea.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(kea.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, kea.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, kea.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, kea.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, kea.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/kea_CV/kea_CV.go b/kea_CV/kea_CV.go
index ebd430da..5f1c0d16 100644
--- a/kea_CV/kea_CV.go
+++ b/kea_CV/kea_CV.go
@@ -220,3 +220,80 @@ func (kea *kea_CV) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kea_CV'
+// 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 (kea *kea_CV) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kea.currencies[currency]
+ l := len(s) + len(kea.decimal) + len(kea.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, kea.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(kea.group) - 1; j >= 0; j-- {
+ b = append(b, kea.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(kea.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, kea.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, kea.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, kea.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, kea.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/khq/khq.go b/khq/khq.go
index 23f6eeeb..bdd21289 100644
--- a/khq/khq.go
+++ b/khq/khq.go
@@ -154,3 +154,79 @@ func (khq *khq) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'khq'
+// 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 (khq *khq) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := khq.currencies[currency]
+ l := len(s) + len(khq.decimal) + len(khq.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(khq.decimal) - 1; j >= 0; j-- {
+ b = append(b, khq.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(khq.group) - 1; j >= 0; j-- {
+ b = append(b, khq.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(khq.minus) - 1; j >= 0; j-- {
+ b = append(b, khq.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, khq.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/khq_ML/khq_ML.go b/khq_ML/khq_ML.go
index f388fa2e..43e3977d 100644
--- a/khq_ML/khq_ML.go
+++ b/khq_ML/khq_ML.go
@@ -154,3 +154,79 @@ func (khq *khq_ML) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'khq_ML'
+// 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 (khq *khq_ML) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := khq.currencies[currency]
+ l := len(s) + len(khq.decimal) + len(khq.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(khq.decimal) - 1; j >= 0; j-- {
+ b = append(b, khq.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(khq.group) - 1; j >= 0; j-- {
+ b = append(b, khq.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(khq.minus) - 1; j >= 0; j-- {
+ b = append(b, khq.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, khq.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ki/ki.go b/ki/ki.go
index 2b35d9f0..3a16bf81 100644
--- a/ki/ki.go
+++ b/ki/ki.go
@@ -160,3 +160,85 @@ func (ki *ki) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ki'
+// 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 (ki *ki) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ki.currencies[currency]
+ l := len(s) + len(ki.decimal) + len(ki.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ki.decimal) - 1; j >= 0; j-- {
+ b = append(b, ki.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ki.group) - 1; j >= 0; j-- {
+ b = append(b, ki.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ki.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ki.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ki.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ki.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ki_KE/ki_KE.go b/ki_KE/ki_KE.go
index 199c8fc9..f693cd38 100644
--- a/ki_KE/ki_KE.go
+++ b/ki_KE/ki_KE.go
@@ -160,3 +160,85 @@ func (ki *ki_KE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ki_KE'
+// 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 (ki *ki_KE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ki.currencies[currency]
+ l := len(s) + len(ki.decimal) + len(ki.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ki.decimal) - 1; j >= 0; j-- {
+ b = append(b, ki.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ki.group) - 1; j >= 0; j-- {
+ b = append(b, ki.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ki.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ki.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ki.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ki.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/kk/kk.go b/kk/kk.go
index 26973e9b..d3922781 100644
--- a/kk/kk.go
+++ b/kk/kk.go
@@ -244,3 +244,78 @@ func (kk *kk) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kk'
+// 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 (kk *kk) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kk.currencies[currency]
+ l := len(s) + len(kk.decimal) + len(kk.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, kk.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(kk.group) - 1; j >= 0; j-- {
+ b = append(b, kk.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, kk.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, kk.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, kk.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, kk.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/kk_KZ/kk_KZ.go b/kk_KZ/kk_KZ.go
index c45824d7..9956a9fe 100644
--- a/kk_KZ/kk_KZ.go
+++ b/kk_KZ/kk_KZ.go
@@ -244,3 +244,78 @@ func (kk *kk_KZ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kk_KZ'
+// 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 (kk *kk_KZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kk.currencies[currency]
+ l := len(s) + len(kk.decimal) + len(kk.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, kk.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(kk.group) - 1; j >= 0; j-- {
+ b = append(b, kk.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, kk.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, kk.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, kk.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, kk.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/kkj/kkj.go b/kkj/kkj.go
index 81fb3dd7..8a87a390 100644
--- a/kkj/kkj.go
+++ b/kkj/kkj.go
@@ -148,3 +148,68 @@ func (kkj *kkj) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kkj'
+// 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 (kkj *kkj) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kkj.currencies[currency]
+ l := len(s) + len(kkj.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, kkj.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(kkj.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, kkj.currencyNegativePrefix[j])
+ }
+
+ for j := len(kkj.minus) - 1; j >= 0; j-- {
+ b = append(b, kkj.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(kkj.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, kkj.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, kkj.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, kkj.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/kkj_CM/kkj_CM.go b/kkj_CM/kkj_CM.go
index 6e2cf599..4add4cd4 100644
--- a/kkj_CM/kkj_CM.go
+++ b/kkj_CM/kkj_CM.go
@@ -148,3 +148,68 @@ func (kkj *kkj_CM) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kkj_CM'
+// 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 (kkj *kkj_CM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kkj.currencies[currency]
+ l := len(s) + len(kkj.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, kkj.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(kkj.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, kkj.currencyNegativePrefix[j])
+ }
+
+ for j := len(kkj.minus) - 1; j >= 0; j-- {
+ b = append(b, kkj.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(kkj.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, kkj.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, kkj.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, kkj.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/kl/kl.go b/kl/kl.go
index e6e88fe8..09cad8c8 100644
--- a/kl/kl.go
+++ b/kl/kl.go
@@ -219,3 +219,71 @@ func (kl *kl) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kl'
+// 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 (kl *kl) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kl.currencies[currency]
+ l := len(s) + len(kl.decimal) + len(kl.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, kl.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, kl.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, kl.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, kl.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/kl_GL/kl_GL.go b/kl_GL/kl_GL.go
index 65290857..9a9a3726 100644
--- a/kl_GL/kl_GL.go
+++ b/kl_GL/kl_GL.go
@@ -219,3 +219,71 @@ func (kl *kl_GL) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kl_GL'
+// 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 (kl *kl_GL) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kl.currencies[currency]
+ l := len(s) + len(kl.decimal) + len(kl.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, kl.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, kl.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, kl.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, kl.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/kln/kln.go b/kln/kln.go
index fe623199..c177f359 100644
--- a/kln/kln.go
+++ b/kln/kln.go
@@ -160,3 +160,85 @@ func (kln *kln) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kln'
+// 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 (kln *kln) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kln.currencies[currency]
+ l := len(s) + len(kln.decimal) + len(kln.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(kln.decimal) - 1; j >= 0; j-- {
+ b = append(b, kln.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(kln.group) - 1; j >= 0; j-- {
+ b = append(b, kln.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(kln.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, kln.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, kln.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, kln.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/kln_KE/kln_KE.go b/kln_KE/kln_KE.go
index d37f125b..4b7b8251 100644
--- a/kln_KE/kln_KE.go
+++ b/kln_KE/kln_KE.go
@@ -160,3 +160,85 @@ func (kln *kln_KE) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kln_KE'
+// 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 (kln *kln_KE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kln.currencies[currency]
+ l := len(s) + len(kln.decimal) + len(kln.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(kln.decimal) - 1; j >= 0; j-- {
+ b = append(b, kln.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(kln.group) - 1; j >= 0; j-- {
+ b = append(b, kln.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(kln.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, kln.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, kln.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, kln.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/km/km.go b/km/km.go
index 4dd32a43..907ddb4b 100644
--- a/km/km.go
+++ b/km/km.go
@@ -212,3 +212,79 @@ func (km *km) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'km'
+// 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 (km *km) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := km.currencies[currency]
+ l := len(s) + len(km.decimal) + len(km.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, km.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, km.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(km.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, km.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, km.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, km.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/km_KH/km_KH.go b/km_KH/km_KH.go
index 5fecd024..c00729f2 100644
--- a/km_KH/km_KH.go
+++ b/km_KH/km_KH.go
@@ -212,3 +212,79 @@ func (km *km_KH) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'km_KH'
+// 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 (km *km_KH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := km.currencies[currency]
+ l := len(s) + len(km.decimal) + len(km.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, km.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, km.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(km.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, km.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, km.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, km.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/kn/kn.go b/kn/kn.go
index 1e0f637d..f830effb 100644
--- a/kn/kn.go
+++ b/kn/kn.go
@@ -231,3 +231,79 @@ func (kn *kn) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kn'
+// 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 (kn *kn) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kn.currencies[currency]
+ l := len(s) + len(kn.decimal) + len(kn.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, kn.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, kn.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(kn.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, kn.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, kn.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, kn.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/kn_IN/kn_IN.go b/kn_IN/kn_IN.go
index bd47cd71..a2263045 100644
--- a/kn_IN/kn_IN.go
+++ b/kn_IN/kn_IN.go
@@ -231,3 +231,79 @@ func (kn *kn_IN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kn_IN'
+// 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 (kn *kn_IN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kn.currencies[currency]
+ l := len(s) + len(kn.decimal) + len(kn.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, kn.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, kn.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(kn.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, kn.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, kn.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, kn.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ko/ko.go b/ko/ko.go
index 7546de27..6c25858b 100644
--- a/ko/ko.go
+++ b/ko/ko.go
@@ -212,3 +212,79 @@ func (ko *ko) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ko'
+// 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 (ko *ko) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ko.currencies[currency]
+ l := len(s) + len(ko.decimal) + len(ko.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ko.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ko.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ko.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ko.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ko.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ko.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ko_KP/ko_KP.go b/ko_KP/ko_KP.go
index 92695f4e..5defb7ba 100644
--- a/ko_KP/ko_KP.go
+++ b/ko_KP/ko_KP.go
@@ -212,3 +212,79 @@ func (ko *ko_KP) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ko_KP'
+// 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 (ko *ko_KP) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ko.currencies[currency]
+ l := len(s) + len(ko.decimal) + len(ko.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ko.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ko.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ko.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ko.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ko.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ko.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ko_KR/ko_KR.go b/ko_KR/ko_KR.go
index c652f872..b7085f03 100644
--- a/ko_KR/ko_KR.go
+++ b/ko_KR/ko_KR.go
@@ -212,3 +212,79 @@ func (ko *ko_KR) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ko_KR'
+// 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 (ko *ko_KR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ko.currencies[currency]
+ l := len(s) + len(ko.decimal) + len(ko.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ko.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ko.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ko.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ko.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ko.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ko.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/kok/kok.go b/kok/kok.go
index d77adff0..662a071b 100644
--- a/kok/kok.go
+++ b/kok/kok.go
@@ -255,3 +255,96 @@ func (kok *kok) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kok'
+// 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 (kok *kok) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kok.currencies[currency]
+ l := len(s) + len(kok.decimal) + len(kok.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(kok.decimal) - 1; j >= 0; j-- {
+ b = append(b, kok.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ for j := len(kok.group) - 1; j >= 0; j-- {
+ b = append(b, kok.group[j])
+ }
+
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(kok.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, kok.currencyNegativePrefix[j])
+ }
+
+ for j := len(kok.minus) - 1; j >= 0; j-- {
+ b = append(b, kok.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(kok.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, kok.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, kok.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/kok_IN/kok_IN.go b/kok_IN/kok_IN.go
index ac00ad37..b78d4c52 100644
--- a/kok_IN/kok_IN.go
+++ b/kok_IN/kok_IN.go
@@ -255,3 +255,96 @@ func (kok *kok_IN) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kok_IN'
+// 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 (kok *kok_IN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kok.currencies[currency]
+ l := len(s) + len(kok.decimal) + len(kok.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(kok.decimal) - 1; j >= 0; j-- {
+ b = append(b, kok.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ for j := len(kok.group) - 1; j >= 0; j-- {
+ b = append(b, kok.group[j])
+ }
+
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(kok.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, kok.currencyNegativePrefix[j])
+ }
+
+ for j := len(kok.minus) - 1; j >= 0; j-- {
+ b = append(b, kok.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(kok.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, kok.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, kok.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ks/ks.go b/ks/ks.go
index 861a6acc..a7d66d8d 100644
--- a/ks/ks.go
+++ b/ks/ks.go
@@ -247,3 +247,90 @@ func (ks *ks) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ks'
+// 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 (ks *ks) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ks.currencies[currency]
+ l := len(s) + len(ks.decimal) + len(ks.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ks.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ b = append(b, ks.group[0])
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ks.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ks.currencyNegativePrefix[j])
+ }
+
+ for j := len(ks.minus) - 1; j >= 0; j-- {
+ b = append(b, ks.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ks.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ks.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ks.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ks_IN/ks_IN.go b/ks_IN/ks_IN.go
index ee74edf8..4f1d9208 100644
--- a/ks_IN/ks_IN.go
+++ b/ks_IN/ks_IN.go
@@ -247,3 +247,90 @@ func (ks *ks_IN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ks_IN'
+// 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 (ks *ks_IN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ks.currencies[currency]
+ l := len(s) + len(ks.decimal) + len(ks.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ks.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ b = append(b, ks.group[0])
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ks.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ks.currencyNegativePrefix[j])
+ }
+
+ for j := len(ks.minus) - 1; j >= 0; j-- {
+ b = append(b, ks.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ks.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ks.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ks.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ksb/ksb.go b/ksb/ksb.go
index 52a557a5..0db02752 100644
--- a/ksb/ksb.go
+++ b/ksb/ksb.go
@@ -161,3 +161,79 @@ func (ksb *ksb) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ksb'
+// 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 (ksb *ksb) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ksb.currencies[currency]
+ l := len(s) + len(ksb.decimal) + len(ksb.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ksb.decimal) - 1; j >= 0; j-- {
+ b = append(b, ksb.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ksb.group) - 1; j >= 0; j-- {
+ b = append(b, ksb.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ksb.minus) - 1; j >= 0; j-- {
+ b = append(b, ksb.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ksb.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ksb_TZ/ksb_TZ.go b/ksb_TZ/ksb_TZ.go
index 3f5d2397..9bee0c9c 100644
--- a/ksb_TZ/ksb_TZ.go
+++ b/ksb_TZ/ksb_TZ.go
@@ -161,3 +161,79 @@ func (ksb *ksb_TZ) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ksb_TZ'
+// 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 (ksb *ksb_TZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ksb.currencies[currency]
+ l := len(s) + len(ksb.decimal) + len(ksb.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ksb.decimal) - 1; j >= 0; j-- {
+ b = append(b, ksb.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ksb.group) - 1; j >= 0; j-- {
+ b = append(b, ksb.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ksb.minus) - 1; j >= 0; j-- {
+ b = append(b, ksb.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ksb.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ksf/ksf.go b/ksf/ksf.go
index 6aa1301f..1a4f6b85 100644
--- a/ksf/ksf.go
+++ b/ksf/ksf.go
@@ -197,3 +197,80 @@ func (ksf *ksf) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ksf'
+// 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 (ksf *ksf) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ksf.currencies[currency]
+ l := len(s) + len(ksf.decimal) + len(ksf.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ksf.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ksf.group) - 1; j >= 0; j-- {
+ b = append(b, ksf.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ksf.minus) - 1; j >= 0; j-- {
+ b = append(b, ksf.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ksf.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ksf.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ksf.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ksf_CM/ksf_CM.go b/ksf_CM/ksf_CM.go
index e3f2d61a..6031d7b3 100644
--- a/ksf_CM/ksf_CM.go
+++ b/ksf_CM/ksf_CM.go
@@ -197,3 +197,80 @@ func (ksf *ksf_CM) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ksf_CM'
+// 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 (ksf *ksf_CM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ksf.currencies[currency]
+ l := len(s) + len(ksf.decimal) + len(ksf.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ksf.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ksf.group) - 1; j >= 0; j-- {
+ b = append(b, ksf.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ksf.minus) - 1; j >= 0; j-- {
+ b = append(b, ksf.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ksf.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ksf.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ksf.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ksh/ksh.go b/ksh/ksh.go
index 7bdbbccb..f6069143 100644
--- a/ksh/ksh.go
+++ b/ksh/ksh.go
@@ -237,3 +237,80 @@ func (ksh *ksh) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ksh'
+// 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 (ksh *ksh) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ksh.currencies[currency]
+ l := len(s) + len(ksh.decimal) + len(ksh.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ksh.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ksh.group) - 1; j >= 0; j-- {
+ b = append(b, ksh.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ksh.minus) - 1; j >= 0; j-- {
+ b = append(b, ksh.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ksh.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ksh.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ksh.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ksh_DE/ksh_DE.go b/ksh_DE/ksh_DE.go
index 0e4ae2d4..ae055d72 100644
--- a/ksh_DE/ksh_DE.go
+++ b/ksh_DE/ksh_DE.go
@@ -237,3 +237,80 @@ func (ksh *ksh_DE) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ksh_DE'
+// 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 (ksh *ksh_DE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ksh.currencies[currency]
+ l := len(s) + len(ksh.decimal) + len(ksh.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ksh.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ksh.group) - 1; j >= 0; j-- {
+ b = append(b, ksh.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ksh.minus) - 1; j >= 0; j-- {
+ b = append(b, ksh.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ksh.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ksh.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ksh.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/kw/kw.go b/kw/kw.go
index 02186b32..1cb63728 100644
--- a/kw/kw.go
+++ b/kw/kw.go
@@ -165,3 +165,79 @@ func (kw *kw) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kw'
+// 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 (kw *kw) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kw.currencies[currency]
+ l := len(s) + len(kw.decimal) + len(kw.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(kw.decimal) - 1; j >= 0; j-- {
+ b = append(b, kw.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(kw.group) - 1; j >= 0; j-- {
+ b = append(b, kw.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(kw.minus) - 1; j >= 0; j-- {
+ b = append(b, kw.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, kw.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/kw_GB/kw_GB.go b/kw_GB/kw_GB.go
index fc1bd2c5..d048ecd1 100644
--- a/kw_GB/kw_GB.go
+++ b/kw_GB/kw_GB.go
@@ -165,3 +165,79 @@ func (kw *kw_GB) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'kw_GB'
+// 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 (kw *kw_GB) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := kw.currencies[currency]
+ l := len(s) + len(kw.decimal) + len(kw.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(kw.decimal) - 1; j >= 0; j-- {
+ b = append(b, kw.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(kw.group) - 1; j >= 0; j-- {
+ b = append(b, kw.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(kw.minus) - 1; j >= 0; j-- {
+ b = append(b, kw.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, kw.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ky/ky.go b/ky/ky.go
index b5254d3d..66a1dc89 100644
--- a/ky/ky.go
+++ b/ky/ky.go
@@ -236,3 +236,78 @@ func (ky *ky) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ky'
+// 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 (ky *ky) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ky.currencies[currency]
+ l := len(s) + len(ky.decimal) + len(ky.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ky.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ky.group) - 1; j >= 0; j-- {
+ b = append(b, ky.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, ky.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ky.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ky.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ky.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ky_KG/ky_KG.go b/ky_KG/ky_KG.go
index 6e67c00c..9625a2f2 100644
--- a/ky_KG/ky_KG.go
+++ b/ky_KG/ky_KG.go
@@ -236,3 +236,78 @@ func (ky *ky_KG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ky_KG'
+// 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 (ky *ky_KG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ky.currencies[currency]
+ l := len(s) + len(ky.decimal) + len(ky.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ky.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ky.group) - 1; j >= 0; j-- {
+ b = append(b, ky.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, ky.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ky.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ky.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ky.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/lag/lag.go b/lag/lag.go
index 33670a65..710f8b23 100644
--- a/lag/lag.go
+++ b/lag/lag.go
@@ -154,3 +154,71 @@ func (lag *lag) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lag'
+// 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 (lag *lag) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := lag.currencies[currency]
+ l := len(s) + len(lag.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(lag.decimal) - 1; j >= 0; j-- {
+ b = append(b, lag.decimal[j])
+ }
+
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(lag.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, lag.currencyNegativePrefix[j])
+ }
+
+ for j := len(lag.minus) - 1; j >= 0; j-- {
+ b = append(b, lag.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(lag.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, lag.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, lag.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, lag.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/lag_TZ/lag_TZ.go b/lag_TZ/lag_TZ.go
index f9424117..88e15397 100644
--- a/lag_TZ/lag_TZ.go
+++ b/lag_TZ/lag_TZ.go
@@ -154,3 +154,71 @@ func (lag *lag_TZ) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lag_TZ'
+// 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 (lag *lag_TZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := lag.currencies[currency]
+ l := len(s) + len(lag.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(lag.decimal) - 1; j >= 0; j-- {
+ b = append(b, lag.decimal[j])
+ }
+
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(lag.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, lag.currencyNegativePrefix[j])
+ }
+
+ for j := len(lag.minus) - 1; j >= 0; j-- {
+ b = append(b, lag.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(lag.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, lag.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, lag.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, lag.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/lb/lb.go b/lb/lb.go
index 8bc0700c..869dc042 100644
--- a/lb/lb.go
+++ b/lb/lb.go
@@ -223,3 +223,75 @@ func (lb *lb) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lb'
+// 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 (lb *lb) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := lb.currencies[currency]
+ l := len(s) + len(lb.decimal) + len(lb.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, lb.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, lb.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, lb.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, lb.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, lb.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, lb.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/lb_LU/lb_LU.go b/lb_LU/lb_LU.go
index d9302046..ecd773c7 100644
--- a/lb_LU/lb_LU.go
+++ b/lb_LU/lb_LU.go
@@ -223,3 +223,75 @@ func (lb *lb_LU) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lb_LU'
+// 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 (lb *lb_LU) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := lb.currencies[currency]
+ l := len(s) + len(lb.decimal) + len(lb.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, lb.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, lb.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, lb.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, lb.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, lb.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, lb.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/lg/lg.go b/lg/lg.go
index d85cfb44..c3a44b5f 100644
--- a/lg/lg.go
+++ b/lg/lg.go
@@ -161,3 +161,79 @@ func (lg *lg) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lg'
+// 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 (lg *lg) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := lg.currencies[currency]
+ l := len(s) + len(lg.decimal) + len(lg.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(lg.decimal) - 1; j >= 0; j-- {
+ b = append(b, lg.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(lg.group) - 1; j >= 0; j-- {
+ b = append(b, lg.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(lg.minus) - 1; j >= 0; j-- {
+ b = append(b, lg.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, lg.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/lg_UG/lg_UG.go b/lg_UG/lg_UG.go
index 56597439..39ad5898 100644
--- a/lg_UG/lg_UG.go
+++ b/lg_UG/lg_UG.go
@@ -161,3 +161,79 @@ func (lg *lg_UG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lg_UG'
+// 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 (lg *lg_UG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := lg.currencies[currency]
+ l := len(s) + len(lg.decimal) + len(lg.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(lg.decimal) - 1; j >= 0; j-- {
+ b = append(b, lg.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(lg.group) - 1; j >= 0; j-- {
+ b = append(b, lg.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(lg.minus) - 1; j >= 0; j-- {
+ b = append(b, lg.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, lg.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/lkt/lkt.go b/lkt/lkt.go
index 61878f7d..0242b4dc 100644
--- a/lkt/lkt.go
+++ b/lkt/lkt.go
@@ -139,3 +139,66 @@ func (lkt *lkt) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lkt'
+// 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 (lkt *lkt) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := lkt.currencies[currency]
+ l := len(s) + len(lkt.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, lkt.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(lkt.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, lkt.currencyNegativePrefix[j])
+ }
+
+ b = append(b, lkt.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(lkt.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, lkt.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, lkt.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, lkt.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/lkt_US/lkt_US.go b/lkt_US/lkt_US.go
index c020d02c..6ca18917 100644
--- a/lkt_US/lkt_US.go
+++ b/lkt_US/lkt_US.go
@@ -139,3 +139,66 @@ func (lkt *lkt_US) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lkt_US'
+// 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 (lkt *lkt_US) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := lkt.currencies[currency]
+ l := len(s) + len(lkt.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, lkt.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(lkt.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, lkt.currencyNegativePrefix[j])
+ }
+
+ b = append(b, lkt.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(lkt.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, lkt.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, lkt.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, lkt.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ln/ln.go b/ln/ln.go
index 7726b41a..6f17f6fd 100644
--- a/ln/ln.go
+++ b/ln/ln.go
@@ -194,3 +194,75 @@ func (ln *ln) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ln'
+// 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 (ln *ln) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ln.currencies[currency]
+ l := len(s) + len(ln.decimal) + len(ln.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ln.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ln.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, ln.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ln.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ln.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ln.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ln_AO/ln_AO.go b/ln_AO/ln_AO.go
index 0ca36960..fc1ce9a3 100644
--- a/ln_AO/ln_AO.go
+++ b/ln_AO/ln_AO.go
@@ -194,3 +194,75 @@ func (ln *ln_AO) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ln_AO'
+// 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 (ln *ln_AO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ln.currencies[currency]
+ l := len(s) + len(ln.decimal) + len(ln.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ln.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ln.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, ln.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ln.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ln.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ln.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ln_CD/ln_CD.go b/ln_CD/ln_CD.go
index d6ff3d6a..5553102e 100644
--- a/ln_CD/ln_CD.go
+++ b/ln_CD/ln_CD.go
@@ -194,3 +194,75 @@ func (ln *ln_CD) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ln_CD'
+// 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 (ln *ln_CD) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ln.currencies[currency]
+ l := len(s) + len(ln.decimal) + len(ln.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ln.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ln.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, ln.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ln.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ln.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ln.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ln_CF/ln_CF.go b/ln_CF/ln_CF.go
index a21957a2..69f09dd6 100644
--- a/ln_CF/ln_CF.go
+++ b/ln_CF/ln_CF.go
@@ -194,3 +194,75 @@ func (ln *ln_CF) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ln_CF'
+// 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 (ln *ln_CF) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ln.currencies[currency]
+ l := len(s) + len(ln.decimal) + len(ln.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ln.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ln.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, ln.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ln.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ln.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ln.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ln_CG/ln_CG.go b/ln_CG/ln_CG.go
index a249c842..4ad19683 100644
--- a/ln_CG/ln_CG.go
+++ b/ln_CG/ln_CG.go
@@ -194,3 +194,75 @@ func (ln *ln_CG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ln_CG'
+// 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 (ln *ln_CG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ln.currencies[currency]
+ l := len(s) + len(ln.decimal) + len(ln.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ln.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ln.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, ln.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ln.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ln.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ln.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/lo/lo.go b/lo/lo.go
index 4acf466e..40717485 100644
--- a/lo/lo.go
+++ b/lo/lo.go
@@ -182,3 +182,73 @@ func (lo *lo) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lo'
+// 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 (lo *lo) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := lo.currencies[currency]
+ l := len(s) + len(lo.decimal) + len(lo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, lo.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, lo.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(lo.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, lo.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, lo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/lo_LA/lo_LA.go b/lo_LA/lo_LA.go
index 6722d45d..df3291f1 100644
--- a/lo_LA/lo_LA.go
+++ b/lo_LA/lo_LA.go
@@ -182,3 +182,73 @@ func (lo *lo_LA) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lo_LA'
+// 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 (lo *lo_LA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := lo.currencies[currency]
+ l := len(s) + len(lo.decimal) + len(lo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, lo.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, lo.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(lo.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, lo.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, lo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/lrc/lrc.go b/lrc/lrc.go
index 3bd69e7c..b15f5d02 100644
--- a/lrc/lrc.go
+++ b/lrc/lrc.go
@@ -216,3 +216,79 @@ func (lrc *lrc) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lrc'
+// 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 (lrc *lrc) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := lrc.currencies[currency]
+ l := len(s) + len(lrc.decimal) + len(lrc.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, lrc.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, lrc.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(lrc.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, lrc.currencyNegativePrefix[j])
+ }
+
+ b = append(b, lrc.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(lrc.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, lrc.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, lrc.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/lrc_IQ/lrc_IQ.go b/lrc_IQ/lrc_IQ.go
index c0a6053e..6ecc986b 100644
--- a/lrc_IQ/lrc_IQ.go
+++ b/lrc_IQ/lrc_IQ.go
@@ -216,3 +216,79 @@ func (lrc *lrc_IQ) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lrc_IQ'
+// 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 (lrc *lrc_IQ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := lrc.currencies[currency]
+ l := len(s) + len(lrc.decimal) + len(lrc.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, lrc.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, lrc.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(lrc.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, lrc.currencyNegativePrefix[j])
+ }
+
+ b = append(b, lrc.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(lrc.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, lrc.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, lrc.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/lrc_IR/lrc_IR.go b/lrc_IR/lrc_IR.go
index ac7df663..a84e9cea 100644
--- a/lrc_IR/lrc_IR.go
+++ b/lrc_IR/lrc_IR.go
@@ -216,3 +216,79 @@ func (lrc *lrc_IR) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lrc_IR'
+// 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 (lrc *lrc_IR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := lrc.currencies[currency]
+ l := len(s) + len(lrc.decimal) + len(lrc.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, lrc.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, lrc.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(lrc.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, lrc.currencyNegativePrefix[j])
+ }
+
+ b = append(b, lrc.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(lrc.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, lrc.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, lrc.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/lt/lt.go b/lt/lt.go
index 5dea475c..0a7a688a 100644
--- a/lt/lt.go
+++ b/lt/lt.go
@@ -279,3 +279,80 @@ func (lt *lt) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lt'
+// 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 (lt *lt) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := lt.currencies[currency]
+ l := len(s) + len(lt.decimal) + len(lt.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, lt.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(lt.group) - 1; j >= 0; j-- {
+ b = append(b, lt.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(lt.minus) - 1; j >= 0; j-- {
+ b = append(b, lt.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, lt.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, lt.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, lt.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/lt_LT/lt_LT.go b/lt_LT/lt_LT.go
index 21091f81..cc694687 100644
--- a/lt_LT/lt_LT.go
+++ b/lt_LT/lt_LT.go
@@ -66,8 +66,8 @@ func (lt *lt_LT) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
f := locales.F(n, v)
- nMod10 := math.Mod(n, 10)
nMod100 := math.Mod(n, 100)
+ nMod10 := math.Mod(n, 10)
if nMod10 == 1 && nMod100 < 11 && nMod100 > 19 {
return locales.PluralRuleOne
@@ -279,3 +279,80 @@ func (lt *lt_LT) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lt_LT'
+// 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 (lt *lt_LT) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := lt.currencies[currency]
+ l := len(s) + len(lt.decimal) + len(lt.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, lt.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(lt.group) - 1; j >= 0; j-- {
+ b = append(b, lt.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(lt.minus) - 1; j >= 0; j-- {
+ b = append(b, lt.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, lt.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, lt.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, lt.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/lu/lu.go b/lu/lu.go
index a1d5f431..36ca8323 100644
--- a/lu/lu.go
+++ b/lu/lu.go
@@ -185,3 +185,73 @@ func (lu *lu) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lu'
+// 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 (lu *lu) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := lu.currencies[currency]
+ l := len(s) + len(lu.decimal) + len(lu.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, lu.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, lu.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(lu.minus) - 1; j >= 0; j-- {
+ b = append(b, lu.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, lu.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/lu_CD/lu_CD.go b/lu_CD/lu_CD.go
index faa75705..cf4614d8 100644
--- a/lu_CD/lu_CD.go
+++ b/lu_CD/lu_CD.go
@@ -185,3 +185,73 @@ func (lu *lu_CD) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lu_CD'
+// 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 (lu *lu_CD) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := lu.currencies[currency]
+ l := len(s) + len(lu.decimal) + len(lu.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, lu.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, lu.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(lu.minus) - 1; j >= 0; j-- {
+ b = append(b, lu.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, lu.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/luo/luo.go b/luo/luo.go
index b030088f..dc79a06f 100644
--- a/luo/luo.go
+++ b/luo/luo.go
@@ -154,3 +154,79 @@ func (luo *luo) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'luo'
+// 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 (luo *luo) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := luo.currencies[currency]
+ l := len(s) + len(luo.decimal) + len(luo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(luo.decimal) - 1; j >= 0; j-- {
+ b = append(b, luo.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(luo.group) - 1; j >= 0; j-- {
+ b = append(b, luo.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(luo.minus) - 1; j >= 0; j-- {
+ b = append(b, luo.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, luo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/luo_KE/luo_KE.go b/luo_KE/luo_KE.go
index 56bdaced..2da64d03 100644
--- a/luo_KE/luo_KE.go
+++ b/luo_KE/luo_KE.go
@@ -154,3 +154,79 @@ func (luo *luo_KE) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'luo_KE'
+// 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 (luo *luo_KE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := luo.currencies[currency]
+ l := len(s) + len(luo.decimal) + len(luo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(luo.decimal) - 1; j >= 0; j-- {
+ b = append(b, luo.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(luo.group) - 1; j >= 0; j-- {
+ b = append(b, luo.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(luo.minus) - 1; j >= 0; j-- {
+ b = append(b, luo.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, luo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/luy/luy.go b/luy/luy.go
index bc9528df..9ca1b964 100644
--- a/luy/luy.go
+++ b/luy/luy.go
@@ -156,3 +156,79 @@ func (luy *luy) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'luy'
+// 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 (luy *luy) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := luy.currencies[currency]
+ l := len(s) + len(luy.decimal) + len(luy.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(luy.decimal) - 1; j >= 0; j-- {
+ b = append(b, luy.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(luy.group) - 1; j >= 0; j-- {
+ b = append(b, luy.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(luy.minus) - 1; j >= 0; j-- {
+ b = append(b, luy.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, luy.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/luy_KE/luy_KE.go b/luy_KE/luy_KE.go
index ee48bea7..6fa522b3 100644
--- a/luy_KE/luy_KE.go
+++ b/luy_KE/luy_KE.go
@@ -156,3 +156,79 @@ func (luy *luy_KE) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'luy_KE'
+// 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 (luy *luy_KE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := luy.currencies[currency]
+ l := len(s) + len(luy.decimal) + len(luy.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(luy.decimal) - 1; j >= 0; j-- {
+ b = append(b, luy.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(luy.group) - 1; j >= 0; j-- {
+ b = append(b, luy.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(luy.minus) - 1; j >= 0; j-- {
+ b = append(b, luy.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, luy.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/lv/lv.go b/lv/lv.go
index 5e596613..0676ab2a 100644
--- a/lv/lv.go
+++ b/lv/lv.go
@@ -64,10 +64,10 @@ func (lv *lv) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
f := locales.F(n, v)
- nMod100 := math.Mod(n, 100)
nMod10 := math.Mod(n, 10)
- fMod10 := f % 10
+ nMod100 := math.Mod(n, 100)
fMod100 := f % 100
+ fMod10 := f % 10
if (nMod10 == 0) || (nMod100 >= 11 && nMod100 <= 19) || (v == 2 && fMod100 >= 11 && fMod100 <= 19) {
return locales.PluralRuleZero
@@ -240,3 +240,63 @@ func (lv *lv) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lv'
+// 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 (lv *lv) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := lv.currencies[currency]
+ l := len(s) + len(lv.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, lv.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, lv.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, lv.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, lv.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, lv.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/lv_LV/lv_LV.go b/lv_LV/lv_LV.go
index f7140397..0fedb12b 100644
--- a/lv_LV/lv_LV.go
+++ b/lv_LV/lv_LV.go
@@ -64,8 +64,8 @@ func (lv *lv_LV) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
f := locales.F(n, v)
- nMod10 := math.Mod(n, 10)
nMod100 := math.Mod(n, 100)
+ nMod10 := math.Mod(n, 10)
fMod100 := f % 100
fMod10 := f % 10
@@ -240,3 +240,63 @@ func (lv *lv_LV) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'lv_LV'
+// 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 (lv *lv_LV) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := lv.currencies[currency]
+ l := len(s) + len(lv.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, lv.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, lv.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, lv.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, lv.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, lv.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/mas/mas.go b/mas/mas.go
index 8432ad06..a4770d2d 100644
--- a/mas/mas.go
+++ b/mas/mas.go
@@ -167,3 +167,85 @@ func (mas *mas) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mas'
+// 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 (mas *mas) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mas.currencies[currency]
+ l := len(s) + len(mas.decimal) + len(mas.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(mas.decimal) - 1; j >= 0; j-- {
+ b = append(b, mas.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(mas.group) - 1; j >= 0; j-- {
+ b = append(b, mas.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mas.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, mas.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, mas.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, mas.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/mas_KE/mas_KE.go b/mas_KE/mas_KE.go
index daf74d66..b8651144 100644
--- a/mas_KE/mas_KE.go
+++ b/mas_KE/mas_KE.go
@@ -167,3 +167,85 @@ func (mas *mas_KE) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mas_KE'
+// 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 (mas *mas_KE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mas.currencies[currency]
+ l := len(s) + len(mas.decimal) + len(mas.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(mas.decimal) - 1; j >= 0; j-- {
+ b = append(b, mas.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(mas.group) - 1; j >= 0; j-- {
+ b = append(b, mas.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mas.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, mas.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, mas.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, mas.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/mas_TZ/mas_TZ.go b/mas_TZ/mas_TZ.go
index 4c112e5e..fed6eaa8 100644
--- a/mas_TZ/mas_TZ.go
+++ b/mas_TZ/mas_TZ.go
@@ -167,3 +167,85 @@ func (mas *mas_TZ) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mas_TZ'
+// 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 (mas *mas_TZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mas.currencies[currency]
+ l := len(s) + len(mas.decimal) + len(mas.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(mas.decimal) - 1; j >= 0; j-- {
+ b = append(b, mas.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(mas.group) - 1; j >= 0; j-- {
+ b = append(b, mas.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mas.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, mas.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, mas.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, mas.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/mer/mer.go b/mer/mer.go
index 2daf8da5..fb29a839 100644
--- a/mer/mer.go
+++ b/mer/mer.go
@@ -160,3 +160,85 @@ func (mer *mer) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mer'
+// 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 (mer *mer) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mer.currencies[currency]
+ l := len(s) + len(mer.decimal) + len(mer.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(mer.decimal) - 1; j >= 0; j-- {
+ b = append(b, mer.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(mer.group) - 1; j >= 0; j-- {
+ b = append(b, mer.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mer.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, mer.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, mer.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, mer.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/mer_KE/mer_KE.go b/mer_KE/mer_KE.go
index 8e0c6a7f..597b674f 100644
--- a/mer_KE/mer_KE.go
+++ b/mer_KE/mer_KE.go
@@ -160,3 +160,85 @@ func (mer *mer_KE) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mer_KE'
+// 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 (mer *mer_KE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mer.currencies[currency]
+ l := len(s) + len(mer.decimal) + len(mer.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(mer.decimal) - 1; j >= 0; j-- {
+ b = append(b, mer.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(mer.group) - 1; j >= 0; j-- {
+ b = append(b, mer.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mer.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, mer.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, mer.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, mer.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/mfe/mfe.go b/mfe/mfe.go
index 7082b639..ed257859 100644
--- a/mfe/mfe.go
+++ b/mfe/mfe.go
@@ -144,3 +144,71 @@ func (mfe *mfe) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mfe'
+// 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 (mfe *mfe) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mfe.currencies[currency]
+ l := len(s) + len(mfe.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(mfe.decimal) - 1; j >= 0; j-- {
+ b = append(b, mfe.decimal[j])
+ }
+
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mfe.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, mfe.currencyNegativePrefix[j])
+ }
+
+ for j := len(mfe.minus) - 1; j >= 0; j-- {
+ b = append(b, mfe.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mfe.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, mfe.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, mfe.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, mfe.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/mfe_MU/mfe_MU.go b/mfe_MU/mfe_MU.go
index dd137fe6..73b6c77d 100644
--- a/mfe_MU/mfe_MU.go
+++ b/mfe_MU/mfe_MU.go
@@ -144,3 +144,71 @@ func (mfe *mfe_MU) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mfe_MU'
+// 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 (mfe *mfe_MU) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mfe.currencies[currency]
+ l := len(s) + len(mfe.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(mfe.decimal) - 1; j >= 0; j-- {
+ b = append(b, mfe.decimal[j])
+ }
+
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mfe.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, mfe.currencyNegativePrefix[j])
+ }
+
+ for j := len(mfe.minus) - 1; j >= 0; j-- {
+ b = append(b, mfe.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mfe.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, mfe.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, mfe.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, mfe.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/mg/mg.go b/mg/mg.go
index 1a1fe648..bc8e94dd 100644
--- a/mg/mg.go
+++ b/mg/mg.go
@@ -163,3 +163,79 @@ func (mg *mg) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mg'
+// 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 (mg *mg) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mg.currencies[currency]
+ l := len(s) + len(mg.decimal) + len(mg.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(mg.decimal) - 1; j >= 0; j-- {
+ b = append(b, mg.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(mg.group) - 1; j >= 0; j-- {
+ b = append(b, mg.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mg.minus) - 1; j >= 0; j-- {
+ b = append(b, mg.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, mg.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/mg_MG/mg_MG.go b/mg_MG/mg_MG.go
index 186fea11..57b972cd 100644
--- a/mg_MG/mg_MG.go
+++ b/mg_MG/mg_MG.go
@@ -163,3 +163,79 @@ func (mg *mg_MG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mg_MG'
+// 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 (mg *mg_MG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mg.currencies[currency]
+ l := len(s) + len(mg.decimal) + len(mg.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(mg.decimal) - 1; j >= 0; j-- {
+ b = append(b, mg.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(mg.group) - 1; j >= 0; j-- {
+ b = append(b, mg.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mg.minus) - 1; j >= 0; j-- {
+ b = append(b, mg.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, mg.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/mgh/mgh.go b/mgh/mgh.go
index 5d98292e..0f7c6365 100644
--- a/mgh/mgh.go
+++ b/mgh/mgh.go
@@ -141,3 +141,68 @@ func (mgh *mgh) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mgh'
+// 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 (mgh *mgh) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mgh.currencies[currency]
+ l := len(s) + len(mgh.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, mgh.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mgh.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, mgh.currencyNegativePrefix[j])
+ }
+
+ for j := len(mgh.minus) - 1; j >= 0; j-- {
+ b = append(b, mgh.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mgh.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, mgh.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, mgh.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, mgh.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/mgh_MZ/mgh_MZ.go b/mgh_MZ/mgh_MZ.go
index 59ad96f3..da66bcac 100644
--- a/mgh_MZ/mgh_MZ.go
+++ b/mgh_MZ/mgh_MZ.go
@@ -141,3 +141,68 @@ func (mgh *mgh_MZ) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mgh_MZ'
+// 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 (mgh *mgh_MZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mgh.currencies[currency]
+ l := len(s) + len(mgh.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, mgh.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mgh.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, mgh.currencyNegativePrefix[j])
+ }
+
+ for j := len(mgh.minus) - 1; j >= 0; j-- {
+ b = append(b, mgh.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mgh.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, mgh.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, mgh.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, mgh.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/mgo/mgo.go b/mgo/mgo.go
index 3579861d..d436361b 100644
--- a/mgo/mgo.go
+++ b/mgo/mgo.go
@@ -223,3 +223,79 @@ func (mgo *mgo) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mgo'
+// 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 (mgo *mgo) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mgo.currencies[currency]
+ l := len(s) + len(mgo.decimal) + len(mgo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, mgo.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, mgo.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mgo.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, mgo.currencyNegativePrefix[j])
+ }
+
+ b = append(b, mgo.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mgo.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, mgo.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, mgo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/mgo_CM/mgo_CM.go b/mgo_CM/mgo_CM.go
index 66be8ead..ff87a62f 100644
--- a/mgo_CM/mgo_CM.go
+++ b/mgo_CM/mgo_CM.go
@@ -223,3 +223,79 @@ func (mgo *mgo_CM) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mgo_CM'
+// 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 (mgo *mgo_CM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mgo.currencies[currency]
+ l := len(s) + len(mgo.decimal) + len(mgo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, mgo.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, mgo.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mgo.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, mgo.currencyNegativePrefix[j])
+ }
+
+ b = append(b, mgo.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mgo.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, mgo.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, mgo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/mk/mk.go b/mk/mk.go
index 7bfe534a..a35ac92a 100644
--- a/mk/mk.go
+++ b/mk/mk.go
@@ -241,3 +241,79 @@ func (mk *mk) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mk'
+// 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 (mk *mk) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mk.currencies[currency]
+ l := len(s) + len(mk.decimal) + len(mk.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, mk.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, mk.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mk.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, mk.currencyNegativePrefix[j])
+ }
+
+ b = append(b, mk.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mk.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, mk.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, mk.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/mk_MK/mk_MK.go b/mk_MK/mk_MK.go
index 2d5ddce7..f87023ec 100644
--- a/mk_MK/mk_MK.go
+++ b/mk_MK/mk_MK.go
@@ -80,8 +80,8 @@ func (mk *mk_MK) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
i := int64(n)
- iMod100 := i % 100
iMod10 := i % 10
+ iMod100 := i % 100
if iMod10 == 1 && iMod100 != 11 {
return locales.PluralRuleOne
@@ -241,3 +241,79 @@ func (mk *mk_MK) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mk_MK'
+// 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 (mk *mk_MK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mk.currencies[currency]
+ l := len(s) + len(mk.decimal) + len(mk.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, mk.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, mk.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mk.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, mk.currencyNegativePrefix[j])
+ }
+
+ b = append(b, mk.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mk.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, mk.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, mk.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ml/ml.go b/ml/ml.go
index 84d7ac6b..e191ba7b 100644
--- a/ml/ml.go
+++ b/ml/ml.go
@@ -239,3 +239,79 @@ func (ml *ml) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ml'
+// 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 (ml *ml) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ml.currencies[currency]
+ l := len(s) + len(ml.decimal) + len(ml.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ml.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ml.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ml.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ml.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ml.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ml.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ml_IN/ml_IN.go b/ml_IN/ml_IN.go
index 3fae6fe1..0c4f2967 100644
--- a/ml_IN/ml_IN.go
+++ b/ml_IN/ml_IN.go
@@ -239,3 +239,79 @@ func (ml *ml_IN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ml_IN'
+// 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 (ml *ml_IN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ml.currencies[currency]
+ l := len(s) + len(ml.decimal) + len(ml.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ml.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ml.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ml.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ml.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ml.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ml.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/mn/mn.go b/mn/mn.go
index b296b44f..c288f9b3 100644
--- a/mn/mn.go
+++ b/mn/mn.go
@@ -234,3 +234,79 @@ func (mn *mn) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mn'
+// 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 (mn *mn) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mn.currencies[currency]
+ l := len(s) + len(mn.decimal) + len(mn.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, mn.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, mn.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mn.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, mn.currencyNegativePrefix[j])
+ }
+
+ b = append(b, mn.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mn.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, mn.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, mn.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/mn_MN/mn_MN.go b/mn_MN/mn_MN.go
index e459be19..096bfe53 100644
--- a/mn_MN/mn_MN.go
+++ b/mn_MN/mn_MN.go
@@ -234,3 +234,79 @@ func (mn *mn_MN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mn_MN'
+// 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 (mn *mn_MN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mn.currencies[currency]
+ l := len(s) + len(mn.decimal) + len(mn.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, mn.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, mn.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mn.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, mn.currencyNegativePrefix[j])
+ }
+
+ b = append(b, mn.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mn.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, mn.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, mn.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/mr/mr.go b/mr/mr.go
index 73260df2..eb785fd2 100644
--- a/mr/mr.go
+++ b/mr/mr.go
@@ -247,3 +247,71 @@ func (mr *mr) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mr'
+// 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 (mr *mr) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mr.currencies[currency]
+ l := len(s) + len(mr.decimal) + len(mr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, mr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, mr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, mr.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, mr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/mr_IN/mr_IN.go b/mr_IN/mr_IN.go
index 849d74bc..fa82607f 100644
--- a/mr_IN/mr_IN.go
+++ b/mr_IN/mr_IN.go
@@ -247,3 +247,71 @@ func (mr *mr_IN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mr_IN'
+// 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 (mr *mr_IN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mr.currencies[currency]
+ l := len(s) + len(mr.decimal) + len(mr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, mr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, mr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, mr.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, mr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ms/ms.go b/ms/ms.go
index edba0115..ddffedef 100644
--- a/ms/ms.go
+++ b/ms/ms.go
@@ -219,3 +219,79 @@ func (ms *ms) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ms'
+// 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 (ms *ms) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ms.currencies[currency]
+ l := len(s) + len(ms.decimal) + len(ms.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ms.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ms.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ms.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ms.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ms.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ms.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ms_BN/ms_BN.go b/ms_BN/ms_BN.go
index 5e9f2f07..07dda8af 100644
--- a/ms_BN/ms_BN.go
+++ b/ms_BN/ms_BN.go
@@ -223,3 +223,79 @@ func (ms *ms_BN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ms_BN'
+// 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 (ms *ms_BN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ms.currencies[currency]
+ l := len(s) + len(ms.decimal) + len(ms.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ms.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ms.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ms.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ms.currencyNegativePrefix[j])
+ }
+
+ b = append(b, ms.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ms.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ms.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ms.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ms_MY/ms_MY.go b/ms_MY/ms_MY.go
index 16bcf356..17df88a3 100644
--- a/ms_MY/ms_MY.go
+++ b/ms_MY/ms_MY.go
@@ -219,3 +219,79 @@ func (ms *ms_MY) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ms_MY'
+// 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 (ms *ms_MY) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ms.currencies[currency]
+ l := len(s) + len(ms.decimal) + len(ms.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ms.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ms.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ms.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ms.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ms.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ms.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ms_SG/ms_SG.go b/ms_SG/ms_SG.go
index b1b32129..c22bb715 100644
--- a/ms_SG/ms_SG.go
+++ b/ms_SG/ms_SG.go
@@ -219,3 +219,79 @@ func (ms *ms_SG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ms_SG'
+// 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 (ms *ms_SG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ms.currencies[currency]
+ l := len(s) + len(ms.decimal) + len(ms.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ms.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ms.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ms.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ms.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ms.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ms.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/mt/mt.go b/mt/mt.go
index 86c098e7..4183f87a 100644
--- a/mt/mt.go
+++ b/mt/mt.go
@@ -220,3 +220,71 @@ func (mt *mt) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mt'
+// 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 (mt *mt) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mt.currencies[currency]
+ l := len(s) + len(mt.decimal) + len(mt.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, mt.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, mt.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, mt.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, mt.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/mt_MT/mt_MT.go b/mt_MT/mt_MT.go
index fb817fc5..8b61823d 100644
--- a/mt_MT/mt_MT.go
+++ b/mt_MT/mt_MT.go
@@ -220,3 +220,71 @@ func (mt *mt_MT) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mt_MT'
+// 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 (mt *mt_MT) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mt.currencies[currency]
+ l := len(s) + len(mt.decimal) + len(mt.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, mt.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, mt.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, mt.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, mt.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/mua/mua.go b/mua/mua.go
index 1650a40d..15e65f62 100644
--- a/mua/mua.go
+++ b/mua/mua.go
@@ -218,3 +218,79 @@ func (mua *mua) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mua'
+// 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 (mua *mua) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mua.currencies[currency]
+ l := len(s) + len(mua.decimal) + len(mua.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, mua.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, mua.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mua.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, mua.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, mua.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, mua.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/mua_CM/mua_CM.go b/mua_CM/mua_CM.go
index 04ac9e04..d2567161 100644
--- a/mua_CM/mua_CM.go
+++ b/mua_CM/mua_CM.go
@@ -218,3 +218,79 @@ func (mua *mua_CM) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mua_CM'
+// 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 (mua *mua_CM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mua.currencies[currency]
+ l := len(s) + len(mua.decimal) + len(mua.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, mua.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, mua.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(mua.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, mua.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, mua.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, mua.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/my/my.go b/my/my.go
index 0abdaf16..fcd30725 100644
--- a/my/my.go
+++ b/my/my.go
@@ -216,3 +216,79 @@ func (my *my) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'my'
+// 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 (my *my) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := my.currencies[currency]
+ l := len(s) + len(my.decimal) + len(my.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, my.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, my.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(my.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, my.currencyNegativePrefix[j])
+ }
+
+ b = append(b, my.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(my.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, my.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, my.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/my_MM/my_MM.go b/my_MM/my_MM.go
index 9255bbdf..18193bc7 100644
--- a/my_MM/my_MM.go
+++ b/my_MM/my_MM.go
@@ -216,3 +216,79 @@ func (my *my_MM) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'my_MM'
+// 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 (my *my_MM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := my.currencies[currency]
+ l := len(s) + len(my.decimal) + len(my.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, my.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, my.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(my.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, my.currencyNegativePrefix[j])
+ }
+
+ b = append(b, my.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(my.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, my.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, my.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/mzn/mzn.go b/mzn/mzn.go
index 15c17f4f..783b75b7 100644
--- a/mzn/mzn.go
+++ b/mzn/mzn.go
@@ -96,5 +96,15 @@ func (mzn *mzn) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
symbol := mzn.currencies[currency]
- return []byte(s)
+ return append(append([]byte{}, symbol...), s...)
+}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mzn'
+// 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 (mzn *mzn) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mzn.currencies[currency]
+ return append(append([]byte{}, symbol...), s...)
}
diff --git a/mzn_IR/mzn_IR.go b/mzn_IR/mzn_IR.go
index 76bbabe8..1da98f1f 100644
--- a/mzn_IR/mzn_IR.go
+++ b/mzn_IR/mzn_IR.go
@@ -96,5 +96,15 @@ func (mzn *mzn_IR) FmtCurrency(num float64, v uint64, currency currency.Type) []
s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
symbol := mzn.currencies[currency]
- return []byte(s)
+ return append(append([]byte{}, symbol...), s...)
+}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'mzn_IR'
+// 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 (mzn *mzn_IR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := mzn.currencies[currency]
+ return append(append([]byte{}, symbol...), s...)
}
diff --git a/naq/naq.go b/naq/naq.go
index 166565cf..fab7feab 100644
--- a/naq/naq.go
+++ b/naq/naq.go
@@ -165,3 +165,79 @@ func (naq *naq) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'naq'
+// 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 (naq *naq) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := naq.currencies[currency]
+ l := len(s) + len(naq.decimal) + len(naq.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(naq.decimal) - 1; j >= 0; j-- {
+ b = append(b, naq.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(naq.group) - 1; j >= 0; j-- {
+ b = append(b, naq.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(naq.minus) - 1; j >= 0; j-- {
+ b = append(b, naq.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, naq.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/naq_NA/naq_NA.go b/naq_NA/naq_NA.go
index eeec54f2..8c3a8090 100644
--- a/naq_NA/naq_NA.go
+++ b/naq_NA/naq_NA.go
@@ -165,3 +165,79 @@ func (naq *naq_NA) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'naq_NA'
+// 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 (naq *naq_NA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := naq.currencies[currency]
+ l := len(s) + len(naq.decimal) + len(naq.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(naq.decimal) - 1; j >= 0; j-- {
+ b = append(b, naq.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(naq.group) - 1; j >= 0; j-- {
+ b = append(b, naq.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(naq.minus) - 1; j >= 0; j-- {
+ b = append(b, naq.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, naq.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/nb/nb.go b/nb/nb.go
index 92a2c180..3d81b071 100644
--- a/nb/nb.go
+++ b/nb/nb.go
@@ -248,3 +248,87 @@ func (nb *nb) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nb'
+// 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 (nb *nb) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nb.currencies[currency]
+ l := len(s) + len(nb.decimal) + len(nb.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(nb.decimal) - 1; j >= 0; j-- {
+ b = append(b, nb.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(nb.group) - 1; j >= 0; j-- {
+ b = append(b, nb.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nb.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, nb.currencyNegativePrefix[j])
+ }
+
+ for j := len(nb.minus) - 1; j >= 0; j-- {
+ b = append(b, nb.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nb.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, nb.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nb.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/nb_NO/nb_NO.go b/nb_NO/nb_NO.go
index 3a3183d0..cc40cab3 100644
--- a/nb_NO/nb_NO.go
+++ b/nb_NO/nb_NO.go
@@ -248,3 +248,87 @@ func (nb *nb_NO) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nb_NO'
+// 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 (nb *nb_NO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nb.currencies[currency]
+ l := len(s) + len(nb.decimal) + len(nb.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(nb.decimal) - 1; j >= 0; j-- {
+ b = append(b, nb.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(nb.group) - 1; j >= 0; j-- {
+ b = append(b, nb.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nb.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, nb.currencyNegativePrefix[j])
+ }
+
+ for j := len(nb.minus) - 1; j >= 0; j-- {
+ b = append(b, nb.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nb.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, nb.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nb.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/nb_SJ/nb_SJ.go b/nb_SJ/nb_SJ.go
index a991ecfa..fc28ca56 100644
--- a/nb_SJ/nb_SJ.go
+++ b/nb_SJ/nb_SJ.go
@@ -248,3 +248,87 @@ func (nb *nb_SJ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nb_SJ'
+// 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 (nb *nb_SJ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nb.currencies[currency]
+ l := len(s) + len(nb.decimal) + len(nb.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(nb.decimal) - 1; j >= 0; j-- {
+ b = append(b, nb.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(nb.group) - 1; j >= 0; j-- {
+ b = append(b, nb.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nb.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, nb.currencyNegativePrefix[j])
+ }
+
+ for j := len(nb.minus) - 1; j >= 0; j-- {
+ b = append(b, nb.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nb.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, nb.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nb.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/nd/nd.go b/nd/nd.go
index da779516..2c15ac99 100644
--- a/nd/nd.go
+++ b/nd/nd.go
@@ -167,3 +167,85 @@ func (nd *nd) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nd'
+// 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 (nd *nd) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nd.currencies[currency]
+ l := len(s) + len(nd.decimal) + len(nd.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(nd.decimal) - 1; j >= 0; j-- {
+ b = append(b, nd.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(nd.group) - 1; j >= 0; j-- {
+ b = append(b, nd.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nd.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, nd.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nd.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, nd.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/nd_ZW/nd_ZW.go b/nd_ZW/nd_ZW.go
index 00dfcc58..3365a6b1 100644
--- a/nd_ZW/nd_ZW.go
+++ b/nd_ZW/nd_ZW.go
@@ -167,3 +167,85 @@ func (nd *nd_ZW) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nd_ZW'
+// 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 (nd *nd_ZW) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nd.currencies[currency]
+ l := len(s) + len(nd.decimal) + len(nd.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(nd.decimal) - 1; j >= 0; j-- {
+ b = append(b, nd.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(nd.group) - 1; j >= 0; j-- {
+ b = append(b, nd.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nd.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, nd.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nd.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, nd.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ne/ne.go b/ne/ne.go
index 010959aa..7a55781a 100644
--- a/ne/ne.go
+++ b/ne/ne.go
@@ -241,3 +241,79 @@ func (ne *ne) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ne'
+// 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 (ne *ne) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ne.currencies[currency]
+ l := len(s) + len(ne.decimal) + len(ne.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ne.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ne.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ne.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ne.currencyNegativePrefix[j])
+ }
+
+ b = append(b, ne.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ne.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ne.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ne.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ne_IN/ne_IN.go b/ne_IN/ne_IN.go
index fdb492b6..f876a6a6 100644
--- a/ne_IN/ne_IN.go
+++ b/ne_IN/ne_IN.go
@@ -241,3 +241,79 @@ func (ne *ne_IN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ne_IN'
+// 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 (ne *ne_IN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ne.currencies[currency]
+ l := len(s) + len(ne.decimal) + len(ne.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ne.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ne.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ne.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ne.currencyNegativePrefix[j])
+ }
+
+ b = append(b, ne.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ne.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ne.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ne.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ne_NP/ne_NP.go b/ne_NP/ne_NP.go
index 3e7cb3ed..dfddeb0c 100644
--- a/ne_NP/ne_NP.go
+++ b/ne_NP/ne_NP.go
@@ -241,3 +241,79 @@ func (ne *ne_NP) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ne_NP'
+// 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 (ne *ne_NP) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ne.currencies[currency]
+ l := len(s) + len(ne.decimal) + len(ne.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ne.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ne.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ne.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ne.currencyNegativePrefix[j])
+ }
+
+ b = append(b, ne.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ne.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ne.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ne.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/nl/nl.go b/nl/nl.go
index 07b80ea5..d209857f 100644
--- a/nl/nl.go
+++ b/nl/nl.go
@@ -258,3 +258,89 @@ func (nl *nl) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nl'
+// 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 (nl *nl) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nl.currencies[currency]
+ l := len(s) + len(nl.decimal) + len(nl.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(nl.decimal) - 1; j >= 0; j-- {
+ b = append(b, nl.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(nl.group) - 1; j >= 0; j-- {
+ b = append(b, nl.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nl.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, nl.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nl.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, nl.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nl.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, nl.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/nl_AW/nl_AW.go b/nl_AW/nl_AW.go
index 36a45bbc..92b84573 100644
--- a/nl_AW/nl_AW.go
+++ b/nl_AW/nl_AW.go
@@ -258,3 +258,89 @@ func (nl *nl_AW) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nl_AW'
+// 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 (nl *nl_AW) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nl.currencies[currency]
+ l := len(s) + len(nl.decimal) + len(nl.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(nl.decimal) - 1; j >= 0; j-- {
+ b = append(b, nl.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(nl.group) - 1; j >= 0; j-- {
+ b = append(b, nl.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nl.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, nl.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nl.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, nl.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nl.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, nl.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/nl_BE/nl_BE.go b/nl_BE/nl_BE.go
index 5bcfb402..f1e98706 100644
--- a/nl_BE/nl_BE.go
+++ b/nl_BE/nl_BE.go
@@ -252,3 +252,83 @@ func (nl *nl_BE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nl_BE'
+// 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 (nl *nl_BE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nl.currencies[currency]
+ l := len(s) + len(nl.decimal) + len(nl.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(nl.decimal) - 1; j >= 0; j-- {
+ b = append(b, nl.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(nl.group) - 1; j >= 0; j-- {
+ b = append(b, nl.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(nl.minus) - 1; j >= 0; j-- {
+ b = append(b, nl.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nl.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, nl.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, nl.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/nl_BQ/nl_BQ.go b/nl_BQ/nl_BQ.go
index 93bf64c9..d6f2643f 100644
--- a/nl_BQ/nl_BQ.go
+++ b/nl_BQ/nl_BQ.go
@@ -258,3 +258,89 @@ func (nl *nl_BQ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nl_BQ'
+// 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 (nl *nl_BQ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nl.currencies[currency]
+ l := len(s) + len(nl.decimal) + len(nl.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(nl.decimal) - 1; j >= 0; j-- {
+ b = append(b, nl.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(nl.group) - 1; j >= 0; j-- {
+ b = append(b, nl.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nl.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, nl.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nl.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, nl.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nl.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, nl.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/nl_CW/nl_CW.go b/nl_CW/nl_CW.go
index c4acfc89..229f36a7 100644
--- a/nl_CW/nl_CW.go
+++ b/nl_CW/nl_CW.go
@@ -258,3 +258,89 @@ func (nl *nl_CW) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nl_CW'
+// 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 (nl *nl_CW) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nl.currencies[currency]
+ l := len(s) + len(nl.decimal) + len(nl.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(nl.decimal) - 1; j >= 0; j-- {
+ b = append(b, nl.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(nl.group) - 1; j >= 0; j-- {
+ b = append(b, nl.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nl.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, nl.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nl.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, nl.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nl.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, nl.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/nl_NL/nl_NL.go b/nl_NL/nl_NL.go
index 94a25bd0..927c6c2c 100644
--- a/nl_NL/nl_NL.go
+++ b/nl_NL/nl_NL.go
@@ -258,3 +258,89 @@ func (nl *nl_NL) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nl_NL'
+// 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 (nl *nl_NL) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nl.currencies[currency]
+ l := len(s) + len(nl.decimal) + len(nl.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(nl.decimal) - 1; j >= 0; j-- {
+ b = append(b, nl.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(nl.group) - 1; j >= 0; j-- {
+ b = append(b, nl.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nl.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, nl.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nl.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, nl.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nl.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, nl.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/nl_SR/nl_SR.go b/nl_SR/nl_SR.go
index ed038b8c..09f7407a 100644
--- a/nl_SR/nl_SR.go
+++ b/nl_SR/nl_SR.go
@@ -258,3 +258,89 @@ func (nl *nl_SR) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nl_SR'
+// 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 (nl *nl_SR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nl.currencies[currency]
+ l := len(s) + len(nl.decimal) + len(nl.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(nl.decimal) - 1; j >= 0; j-- {
+ b = append(b, nl.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(nl.group) - 1; j >= 0; j-- {
+ b = append(b, nl.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nl.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, nl.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nl.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, nl.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nl.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, nl.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/nl_SX/nl_SX.go b/nl_SX/nl_SX.go
index 64c6ba45..e4c1d608 100644
--- a/nl_SX/nl_SX.go
+++ b/nl_SX/nl_SX.go
@@ -258,3 +258,89 @@ func (nl *nl_SX) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nl_SX'
+// 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 (nl *nl_SX) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nl.currencies[currency]
+ l := len(s) + len(nl.decimal) + len(nl.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(nl.decimal) - 1; j >= 0; j-- {
+ b = append(b, nl.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(nl.group) - 1; j >= 0; j-- {
+ b = append(b, nl.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nl.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, nl.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nl.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, nl.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nl.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, nl.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/nmg/nmg.go b/nmg/nmg.go
index 8c7cc4bd..42df3177 100644
--- a/nmg/nmg.go
+++ b/nmg/nmg.go
@@ -224,3 +224,80 @@ func (nmg *nmg) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nmg'
+// 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 (nmg *nmg) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nmg.currencies[currency]
+ l := len(s) + len(nmg.decimal) + len(nmg.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, nmg.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(nmg.group) - 1; j >= 0; j-- {
+ b = append(b, nmg.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(nmg.minus) - 1; j >= 0; j-- {
+ b = append(b, nmg.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nmg.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, nmg.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, nmg.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/nmg_CM/nmg_CM.go b/nmg_CM/nmg_CM.go
index 4419c4f2..8f90f971 100644
--- a/nmg_CM/nmg_CM.go
+++ b/nmg_CM/nmg_CM.go
@@ -224,3 +224,80 @@ func (nmg *nmg_CM) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nmg_CM'
+// 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 (nmg *nmg_CM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nmg.currencies[currency]
+ l := len(s) + len(nmg.decimal) + len(nmg.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, nmg.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(nmg.group) - 1; j >= 0; j-- {
+ b = append(b, nmg.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(nmg.minus) - 1; j >= 0; j-- {
+ b = append(b, nmg.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nmg.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, nmg.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, nmg.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/nn/nn.go b/nn/nn.go
index 2128c823..e98a71d1 100644
--- a/nn/nn.go
+++ b/nn/nn.go
@@ -235,3 +235,80 @@ func (nn *nn) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nn'
+// 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 (nn *nn) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nn.currencies[currency]
+ l := len(s) + len(nn.decimal) + len(nn.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, nn.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(nn.group) - 1; j >= 0; j-- {
+ b = append(b, nn.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(nn.minus) - 1; j >= 0; j-- {
+ b = append(b, nn.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nn.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, nn.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, nn.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/nn_NO/nn_NO.go b/nn_NO/nn_NO.go
index 7065d256..99eac173 100644
--- a/nn_NO/nn_NO.go
+++ b/nn_NO/nn_NO.go
@@ -235,3 +235,80 @@ func (nn *nn_NO) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nn_NO'
+// 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 (nn *nn_NO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nn.currencies[currency]
+ l := len(s) + len(nn.decimal) + len(nn.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, nn.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(nn.group) - 1; j >= 0; j-- {
+ b = append(b, nn.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(nn.minus) - 1; j >= 0; j-- {
+ b = append(b, nn.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nn.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, nn.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, nn.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/nnh/nnh.go b/nnh/nnh.go
index d5b20391..7d558930 100644
--- a/nnh/nnh.go
+++ b/nnh/nnh.go
@@ -202,3 +202,81 @@ func (nnh *nnh) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nnh'
+// 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 (nnh *nnh) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nnh.currencies[currency]
+ l := len(s) + len(nnh.decimal) + len(nnh.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, nnh.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, nnh.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nnh.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, nnh.currencyNegativePrefix[j])
+ }
+
+ for j := len(nnh.minus) - 1; j >= 0; j-- {
+ b = append(b, nnh.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nnh.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, nnh.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nnh.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/nnh_CM/nnh_CM.go b/nnh_CM/nnh_CM.go
index 8b93c9f4..7e9f4a35 100644
--- a/nnh_CM/nnh_CM.go
+++ b/nnh_CM/nnh_CM.go
@@ -202,3 +202,81 @@ func (nnh *nnh_CM) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nnh_CM'
+// 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 (nnh *nnh_CM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nnh.currencies[currency]
+ l := len(s) + len(nnh.decimal) + len(nnh.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, nnh.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, nnh.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nnh.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, nnh.currencyNegativePrefix[j])
+ }
+
+ for j := len(nnh.minus) - 1; j >= 0; j-- {
+ b = append(b, nnh.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nnh.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, nnh.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nnh.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/nus/nus.go b/nus/nus.go
index 79802045..b133daf8 100644
--- a/nus/nus.go
+++ b/nus/nus.go
@@ -218,3 +218,79 @@ func (nus *nus) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nus'
+// 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 (nus *nus) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nus.currencies[currency]
+ l := len(s) + len(nus.decimal) + len(nus.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, nus.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, nus.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nus.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, nus.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nus.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, nus.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/nus_SS/nus_SS.go b/nus_SS/nus_SS.go
index c8c23710..79a5ed8a 100644
--- a/nus_SS/nus_SS.go
+++ b/nus_SS/nus_SS.go
@@ -218,3 +218,79 @@ func (nus *nus_SS) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nus_SS'
+// 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 (nus *nus_SS) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nus.currencies[currency]
+ l := len(s) + len(nus.decimal) + len(nus.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, nus.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, nus.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nus.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, nus.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nus.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, nus.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/nyn/nyn.go b/nyn/nyn.go
index 3b99b0fc..f822824b 100644
--- a/nyn/nyn.go
+++ b/nyn/nyn.go
@@ -163,3 +163,79 @@ func (nyn *nyn) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nyn'
+// 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 (nyn *nyn) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nyn.currencies[currency]
+ l := len(s) + len(nyn.decimal) + len(nyn.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(nyn.decimal) - 1; j >= 0; j-- {
+ b = append(b, nyn.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(nyn.group) - 1; j >= 0; j-- {
+ b = append(b, nyn.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nyn.minus) - 1; j >= 0; j-- {
+ b = append(b, nyn.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nyn.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/nyn_UG/nyn_UG.go b/nyn_UG/nyn_UG.go
index 8967395c..eb871adc 100644
--- a/nyn_UG/nyn_UG.go
+++ b/nyn_UG/nyn_UG.go
@@ -163,3 +163,79 @@ func (nyn *nyn_UG) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'nyn_UG'
+// 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 (nyn *nyn_UG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := nyn.currencies[currency]
+ l := len(s) + len(nyn.decimal) + len(nyn.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(nyn.decimal) - 1; j >= 0; j-- {
+ b = append(b, nyn.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(nyn.group) - 1; j >= 0; j-- {
+ b = append(b, nyn.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(nyn.minus) - 1; j >= 0; j-- {
+ b = append(b, nyn.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, nyn.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/om/om.go b/om/om.go
index 81e257ab..ac673ecd 100644
--- a/om/om.go
+++ b/om/om.go
@@ -163,3 +163,79 @@ func (om *om) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'om'
+// 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 (om *om) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := om.currencies[currency]
+ l := len(s) + len(om.decimal) + len(om.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(om.decimal) - 1; j >= 0; j-- {
+ b = append(b, om.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(om.group) - 1; j >= 0; j-- {
+ b = append(b, om.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(om.minus) - 1; j >= 0; j-- {
+ b = append(b, om.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, om.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/om_ET/om_ET.go b/om_ET/om_ET.go
index cb1e425b..d77c1d7b 100644
--- a/om_ET/om_ET.go
+++ b/om_ET/om_ET.go
@@ -163,3 +163,79 @@ func (om *om_ET) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'om_ET'
+// 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 (om *om_ET) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := om.currencies[currency]
+ l := len(s) + len(om.decimal) + len(om.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(om.decimal) - 1; j >= 0; j-- {
+ b = append(b, om.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(om.group) - 1; j >= 0; j-- {
+ b = append(b, om.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(om.minus) - 1; j >= 0; j-- {
+ b = append(b, om.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, om.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/om_KE/om_KE.go b/om_KE/om_KE.go
index 4832cee7..985f5a86 100644
--- a/om_KE/om_KE.go
+++ b/om_KE/om_KE.go
@@ -163,3 +163,79 @@ func (om *om_KE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'om_KE'
+// 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 (om *om_KE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := om.currencies[currency]
+ l := len(s) + len(om.decimal) + len(om.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(om.decimal) - 1; j >= 0; j-- {
+ b = append(b, om.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(om.group) - 1; j >= 0; j-- {
+ b = append(b, om.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(om.minus) - 1; j >= 0; j-- {
+ b = append(b, om.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, om.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/or/or.go b/or/or.go
index 2dcb1205..4c5a5353 100644
--- a/or/or.go
+++ b/or/or.go
@@ -247,3 +247,90 @@ func (or *or) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'or'
+// 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 (or *or) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := or.currencies[currency]
+ l := len(s) + len(or.decimal) + len(or.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, or.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ b = append(b, or.group[0])
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(or.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, or.currencyNegativePrefix[j])
+ }
+
+ for j := len(or.minus) - 1; j >= 0; j-- {
+ b = append(b, or.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(or.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, or.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, or.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/or_IN/or_IN.go b/or_IN/or_IN.go
index 2f7a6223..0d106f8f 100644
--- a/or_IN/or_IN.go
+++ b/or_IN/or_IN.go
@@ -247,3 +247,90 @@ func (or *or_IN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'or_IN'
+// 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 (or *or_IN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := or.currencies[currency]
+ l := len(s) + len(or.decimal) + len(or.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, or.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ b = append(b, or.group[0])
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(or.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, or.currencyNegativePrefix[j])
+ }
+
+ for j := len(or.minus) - 1; j >= 0; j-- {
+ b = append(b, or.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(or.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, or.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, or.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/os/os.go b/os/os.go
index fb0d4c18..c2c314c4 100644
--- a/os/os.go
+++ b/os/os.go
@@ -229,3 +229,82 @@ func (os *os) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'os'
+// 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 (os *os) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := os.currencies[currency]
+ l := len(s) + len(os.decimal) + len(os.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, os.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(os.group) - 1; j >= 0; j-- {
+ b = append(b, os.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(os.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, os.currencyNegativePrefix[j])
+ }
+
+ b = append(b, os.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(os.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, os.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, os.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/os_GE/os_GE.go b/os_GE/os_GE.go
index 90c1b869..6aa54e39 100644
--- a/os_GE/os_GE.go
+++ b/os_GE/os_GE.go
@@ -229,3 +229,82 @@ func (os *os_GE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'os_GE'
+// 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 (os *os_GE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := os.currencies[currency]
+ l := len(s) + len(os.decimal) + len(os.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, os.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(os.group) - 1; j >= 0; j-- {
+ b = append(b, os.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(os.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, os.currencyNegativePrefix[j])
+ }
+
+ b = append(b, os.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(os.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, os.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, os.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/os_RU/os_RU.go b/os_RU/os_RU.go
index 53076eac..ca429679 100644
--- a/os_RU/os_RU.go
+++ b/os_RU/os_RU.go
@@ -229,3 +229,82 @@ func (os *os_RU) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'os_RU'
+// 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 (os *os_RU) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := os.currencies[currency]
+ l := len(s) + len(os.decimal) + len(os.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, os.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(os.group) - 1; j >= 0; j-- {
+ b = append(b, os.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(os.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, os.currencyNegativePrefix[j])
+ }
+
+ b = append(b, os.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(os.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, os.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, os.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/pa/pa.go b/pa/pa.go
index bee6371c..ad8070b4 100644
--- a/pa/pa.go
+++ b/pa/pa.go
@@ -253,3 +253,83 @@ func (pa *pa) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pa'
+// 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 (pa *pa) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := pa.currencies[currency]
+ l := len(s) + len(pa.decimal) + len(pa.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(pa.decimal) - 1; j >= 0; j-- {
+ b = append(b, pa.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ b = append(b, pa.group[0])
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, pa.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, pa.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/pa_Arab/pa_Arab.go b/pa_Arab/pa_Arab.go
index eb4d93da..38d14995 100644
--- a/pa_Arab/pa_Arab.go
+++ b/pa_Arab/pa_Arab.go
@@ -241,3 +241,71 @@ func (pa *pa_Arab) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pa_Arab'
+// 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 (pa *pa_Arab) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := pa.currencies[currency]
+ l := len(s) + len(pa.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(pa.decimal) - 1; j >= 0; j-- {
+ b = append(b, pa.decimal[j])
+ }
+
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(pa.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, pa.currencyNegativePrefix[j])
+ }
+
+ for j := len(pa.minus) - 1; j >= 0; j-- {
+ b = append(b, pa.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(pa.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, pa.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, pa.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, pa.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/pa_Arab_PK/pa_Arab_PK.go b/pa_Arab_PK/pa_Arab_PK.go
index 8af5d98b..4b85ad07 100644
--- a/pa_Arab_PK/pa_Arab_PK.go
+++ b/pa_Arab_PK/pa_Arab_PK.go
@@ -253,3 +253,83 @@ func (pa *pa_Arab_PK) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pa_Arab_PK'
+// 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 (pa *pa_Arab_PK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := pa.currencies[currency]
+ l := len(s) + len(pa.decimal) + len(pa.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(pa.decimal) - 1; j >= 0; j-- {
+ b = append(b, pa.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ b = append(b, pa.group[0])
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, pa.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, pa.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/pa_Guru/pa_Guru.go b/pa_Guru/pa_Guru.go
index 4a8e2efa..e6e08cc6 100644
--- a/pa_Guru/pa_Guru.go
+++ b/pa_Guru/pa_Guru.go
@@ -253,3 +253,83 @@ func (pa *pa_Guru) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pa_Guru'
+// 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 (pa *pa_Guru) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := pa.currencies[currency]
+ l := len(s) + len(pa.decimal) + len(pa.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(pa.decimal) - 1; j >= 0; j-- {
+ b = append(b, pa.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ b = append(b, pa.group[0])
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, pa.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, pa.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/pa_Guru_IN/pa_Guru_IN.go b/pa_Guru_IN/pa_Guru_IN.go
index d578f602..ebfde575 100644
--- a/pa_Guru_IN/pa_Guru_IN.go
+++ b/pa_Guru_IN/pa_Guru_IN.go
@@ -253,3 +253,83 @@ func (pa *pa_Guru_IN) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pa_Guru_IN'
+// 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 (pa *pa_Guru_IN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := pa.currencies[currency]
+ l := len(s) + len(pa.decimal) + len(pa.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(pa.decimal) - 1; j >= 0; j-- {
+ b = append(b, pa.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ b = append(b, pa.group[0])
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, pa.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, pa.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/pl/pl.go b/pl/pl.go
index aeb840f5..0a9bd3ee 100644
--- a/pl/pl.go
+++ b/pl/pl.go
@@ -267,3 +267,80 @@ func (pl *pl) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pl'
+// 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 (pl *pl) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := pl.currencies[currency]
+ l := len(s) + len(pl.decimal) + len(pl.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, pl.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(pl.group) - 1; j >= 0; j-- {
+ b = append(b, pl.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(pl.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, pl.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, pl.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, pl.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, pl.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/pl_PL/pl_PL.go b/pl_PL/pl_PL.go
index ace199d7..a913c5ad 100644
--- a/pl_PL/pl_PL.go
+++ b/pl_PL/pl_PL.go
@@ -267,3 +267,80 @@ func (pl *pl_PL) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pl_PL'
+// 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 (pl *pl_PL) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := pl.currencies[currency]
+ l := len(s) + len(pl.decimal) + len(pl.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, pl.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(pl.group) - 1; j >= 0; j-- {
+ b = append(b, pl.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(pl.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, pl.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, pl.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, pl.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, pl.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/prg/prg.go b/prg/prg.go
index d74b6838..2c6cf79f 100644
--- a/prg/prg.go
+++ b/prg/prg.go
@@ -64,8 +64,8 @@ func (prg *prg) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
f := locales.F(n, v)
- nMod10 := math.Mod(n, 10)
nMod100 := math.Mod(n, 100)
+ nMod10 := math.Mod(n, 10)
fMod100 := f % 100
fMod10 := f % 10
@@ -232,3 +232,78 @@ func (prg *prg) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'prg'
+// 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 (prg *prg) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := prg.currencies[currency]
+ l := len(s) + len(prg.decimal) + len(prg.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, prg.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(prg.group) - 1; j >= 0; j-- {
+ b = append(b, prg.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, prg.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, prg.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, prg.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, prg.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/prg_001/prg_001.go b/prg_001/prg_001.go
index a793c364..4a211027 100644
--- a/prg_001/prg_001.go
+++ b/prg_001/prg_001.go
@@ -232,3 +232,78 @@ func (prg *prg_001) FmtCurrency(num float64, v uint64, currency currency.Type) [
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'prg_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 (prg *prg_001) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := prg.currencies[currency]
+ l := len(s) + len(prg.decimal) + len(prg.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, prg.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(prg.group) - 1; j >= 0; j-- {
+ b = append(b, prg.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, prg.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, prg.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, prg.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, prg.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ps/ps.go b/ps/ps.go
index e294e0b2..584bcd78 100644
--- a/ps/ps.go
+++ b/ps/ps.go
@@ -167,3 +167,83 @@ func (ps *ps) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ps'
+// 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 (ps *ps) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ps.currencies[currency]
+ l := len(s) + len(ps.decimal) + len(ps.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ps.decimal) - 1; j >= 0; j-- {
+ b = append(b, ps.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ps.group) - 1; j >= 0; j-- {
+ b = append(b, ps.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ps.minus) - 1; j >= 0; j-- {
+ b = append(b, ps.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ps.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ps.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ps.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ps_AF/ps_AF.go b/ps_AF/ps_AF.go
index 3dad321e..9deadfa2 100644
--- a/ps_AF/ps_AF.go
+++ b/ps_AF/ps_AF.go
@@ -167,3 +167,83 @@ func (ps *ps_AF) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ps_AF'
+// 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 (ps *ps_AF) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ps.currencies[currency]
+ l := len(s) + len(ps.decimal) + len(ps.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ps.decimal) - 1; j >= 0; j-- {
+ b = append(b, ps.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ps.group) - 1; j >= 0; j-- {
+ b = append(b, ps.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ps.minus) - 1; j >= 0; j-- {
+ b = append(b, ps.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ps.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ps.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ps.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/pt/pt.go b/pt/pt.go
index ee042379..7bb6d762 100644
--- a/pt/pt.go
+++ b/pt/pt.go
@@ -230,3 +230,79 @@ func (pt *pt) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pt'
+// 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 (pt *pt) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := pt.currencies[currency]
+ l := len(s) + len(pt.decimal) + len(pt.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, pt.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, pt.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(pt.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, pt.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, pt.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, pt.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/pt_AO/pt_AO.go b/pt_AO/pt_AO.go
index 9790b08b..381a1777 100644
--- a/pt_AO/pt_AO.go
+++ b/pt_AO/pt_AO.go
@@ -230,3 +230,79 @@ func (pt *pt_AO) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pt_AO'
+// 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 (pt *pt_AO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := pt.currencies[currency]
+ l := len(s) + len(pt.decimal) + len(pt.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, pt.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, pt.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(pt.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, pt.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, pt.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, pt.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/pt_BR/pt_BR.go b/pt_BR/pt_BR.go
index a28908fb..61efcb65 100644
--- a/pt_BR/pt_BR.go
+++ b/pt_BR/pt_BR.go
@@ -230,3 +230,79 @@ func (pt *pt_BR) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pt_BR'
+// 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 (pt *pt_BR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := pt.currencies[currency]
+ l := len(s) + len(pt.decimal) + len(pt.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, pt.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, pt.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(pt.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, pt.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, pt.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, pt.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/pt_CH/pt_CH.go b/pt_CH/pt_CH.go
index f7e0c089..fb155225 100644
--- a/pt_CH/pt_CH.go
+++ b/pt_CH/pt_CH.go
@@ -230,3 +230,79 @@ func (pt *pt_CH) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pt_CH'
+// 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 (pt *pt_CH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := pt.currencies[currency]
+ l := len(s) + len(pt.decimal) + len(pt.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, pt.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, pt.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(pt.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, pt.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, pt.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, pt.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/pt_CV/pt_CV.go b/pt_CV/pt_CV.go
index 7892e334..b999cc9f 100644
--- a/pt_CV/pt_CV.go
+++ b/pt_CV/pt_CV.go
@@ -230,3 +230,79 @@ func (pt *pt_CV) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pt_CV'
+// 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 (pt *pt_CV) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := pt.currencies[currency]
+ l := len(s) + len(pt.decimal) + len(pt.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, pt.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, pt.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(pt.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, pt.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, pt.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, pt.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/pt_GQ/pt_GQ.go b/pt_GQ/pt_GQ.go
index 1e67e888..beefa09c 100644
--- a/pt_GQ/pt_GQ.go
+++ b/pt_GQ/pt_GQ.go
@@ -230,3 +230,79 @@ func (pt *pt_GQ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pt_GQ'
+// 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 (pt *pt_GQ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := pt.currencies[currency]
+ l := len(s) + len(pt.decimal) + len(pt.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, pt.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, pt.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(pt.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, pt.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, pt.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, pt.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/pt_GW/pt_GW.go b/pt_GW/pt_GW.go
index 6a4fbb92..5821fcb9 100644
--- a/pt_GW/pt_GW.go
+++ b/pt_GW/pt_GW.go
@@ -230,3 +230,79 @@ func (pt *pt_GW) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pt_GW'
+// 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 (pt *pt_GW) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := pt.currencies[currency]
+ l := len(s) + len(pt.decimal) + len(pt.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, pt.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, pt.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(pt.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, pt.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, pt.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, pt.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/pt_LU/pt_LU.go b/pt_LU/pt_LU.go
index b5e892d3..a08bd11a 100644
--- a/pt_LU/pt_LU.go
+++ b/pt_LU/pt_LU.go
@@ -230,3 +230,79 @@ func (pt *pt_LU) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pt_LU'
+// 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 (pt *pt_LU) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := pt.currencies[currency]
+ l := len(s) + len(pt.decimal) + len(pt.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, pt.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, pt.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(pt.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, pt.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, pt.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, pt.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/pt_MO/pt_MO.go b/pt_MO/pt_MO.go
index a3d0096c..64266066 100644
--- a/pt_MO/pt_MO.go
+++ b/pt_MO/pt_MO.go
@@ -230,3 +230,79 @@ func (pt *pt_MO) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pt_MO'
+// 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 (pt *pt_MO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := pt.currencies[currency]
+ l := len(s) + len(pt.decimal) + len(pt.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, pt.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, pt.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(pt.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, pt.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, pt.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, pt.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/pt_MZ/pt_MZ.go b/pt_MZ/pt_MZ.go
index 83163f21..217868c1 100644
--- a/pt_MZ/pt_MZ.go
+++ b/pt_MZ/pt_MZ.go
@@ -230,3 +230,79 @@ func (pt *pt_MZ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pt_MZ'
+// 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 (pt *pt_MZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := pt.currencies[currency]
+ l := len(s) + len(pt.decimal) + len(pt.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, pt.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, pt.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(pt.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, pt.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, pt.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, pt.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/pt_PT/pt_PT.go b/pt_PT/pt_PT.go
index 54e6daa4..ebb07ff6 100644
--- a/pt_PT/pt_PT.go
+++ b/pt_PT/pt_PT.go
@@ -238,3 +238,80 @@ func (pt *pt_PT) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pt_PT'
+// 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 (pt *pt_PT) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := pt.currencies[currency]
+ l := len(s) + len(pt.decimal) + len(pt.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, pt.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(pt.group) - 1; j >= 0; j-- {
+ b = append(b, pt.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(pt.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, pt.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, pt.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, pt.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, pt.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/pt_ST/pt_ST.go b/pt_ST/pt_ST.go
index e3767413..093219a4 100644
--- a/pt_ST/pt_ST.go
+++ b/pt_ST/pt_ST.go
@@ -230,3 +230,79 @@ func (pt *pt_ST) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pt_ST'
+// 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 (pt *pt_ST) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := pt.currencies[currency]
+ l := len(s) + len(pt.decimal) + len(pt.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, pt.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, pt.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(pt.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, pt.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, pt.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, pt.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/pt_TL/pt_TL.go b/pt_TL/pt_TL.go
index 38c0a9d3..56a1544a 100644
--- a/pt_TL/pt_TL.go
+++ b/pt_TL/pt_TL.go
@@ -230,3 +230,79 @@ func (pt *pt_TL) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'pt_TL'
+// 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 (pt *pt_TL) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := pt.currencies[currency]
+ l := len(s) + len(pt.decimal) + len(pt.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, pt.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, pt.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(pt.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, pt.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, pt.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, pt.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/qu/qu.go b/qu/qu.go
index dec2ffab..ccab9f0f 100644
--- a/qu/qu.go
+++ b/qu/qu.go
@@ -220,3 +220,79 @@ func (qu *qu) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'qu'
+// 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 (qu *qu) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := qu.currencies[currency]
+ l := len(s) + len(qu.decimal) + len(qu.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, qu.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, qu.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(qu.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, qu.currencyNegativePrefix[j])
+ }
+
+ b = append(b, qu.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(qu.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, qu.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, qu.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/qu_BO/qu_BO.go b/qu_BO/qu_BO.go
index 09f05905..5923b5b8 100644
--- a/qu_BO/qu_BO.go
+++ b/qu_BO/qu_BO.go
@@ -220,3 +220,79 @@ func (qu *qu_BO) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'qu_BO'
+// 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 (qu *qu_BO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := qu.currencies[currency]
+ l := len(s) + len(qu.decimal) + len(qu.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, qu.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, qu.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(qu.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, qu.currencyNegativePrefix[j])
+ }
+
+ b = append(b, qu.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(qu.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, qu.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, qu.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/qu_EC/qu_EC.go b/qu_EC/qu_EC.go
index c61f1649..49b24a20 100644
--- a/qu_EC/qu_EC.go
+++ b/qu_EC/qu_EC.go
@@ -220,3 +220,79 @@ func (qu *qu_EC) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'qu_EC'
+// 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 (qu *qu_EC) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := qu.currencies[currency]
+ l := len(s) + len(qu.decimal) + len(qu.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, qu.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, qu.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(qu.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, qu.currencyNegativePrefix[j])
+ }
+
+ b = append(b, qu.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(qu.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, qu.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, qu.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/qu_PE/qu_PE.go b/qu_PE/qu_PE.go
index 1bcf5cab..63daf3f5 100644
--- a/qu_PE/qu_PE.go
+++ b/qu_PE/qu_PE.go
@@ -220,3 +220,79 @@ func (qu *qu_PE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'qu_PE'
+// 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 (qu *qu_PE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := qu.currencies[currency]
+ l := len(s) + len(qu.decimal) + len(qu.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, qu.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, qu.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(qu.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, qu.currencyNegativePrefix[j])
+ }
+
+ b = append(b, qu.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(qu.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, qu.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, qu.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/rm/rm.go b/rm/rm.go
index 5df700bf..884b247c 100644
--- a/rm/rm.go
+++ b/rm/rm.go
@@ -235,3 +235,80 @@ func (rm *rm) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'rm'
+// 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 (rm *rm) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := rm.currencies[currency]
+ l := len(s) + len(rm.decimal) + len(rm.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, rm.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(rm.group) - 1; j >= 0; j-- {
+ b = append(b, rm.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(rm.minus) - 1; j >= 0; j-- {
+ b = append(b, rm.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, rm.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, rm.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, rm.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/rm_CH/rm_CH.go b/rm_CH/rm_CH.go
index ea929027..76e752d5 100644
--- a/rm_CH/rm_CH.go
+++ b/rm_CH/rm_CH.go
@@ -235,3 +235,80 @@ func (rm *rm_CH) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'rm_CH'
+// 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 (rm *rm_CH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := rm.currencies[currency]
+ l := len(s) + len(rm.decimal) + len(rm.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, rm.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(rm.group) - 1; j >= 0; j-- {
+ b = append(b, rm.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(rm.minus) - 1; j >= 0; j-- {
+ b = append(b, rm.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, rm.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, rm.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, rm.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/rn/rn.go b/rn/rn.go
index c84128a4..a94edf19 100644
--- a/rn/rn.go
+++ b/rn/rn.go
@@ -216,3 +216,73 @@ func (rn *rn) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'rn'
+// 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 (rn *rn) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := rn.currencies[currency]
+ l := len(s) + len(rn.decimal) + len(rn.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, rn.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, rn.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(rn.minus) - 1; j >= 0; j-- {
+ b = append(b, rn.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, rn.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/rn_BI/rn_BI.go b/rn_BI/rn_BI.go
index f8ec39a0..141f6fc5 100644
--- a/rn_BI/rn_BI.go
+++ b/rn_BI/rn_BI.go
@@ -216,3 +216,73 @@ func (rn *rn_BI) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'rn_BI'
+// 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 (rn *rn_BI) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := rn.currencies[currency]
+ l := len(s) + len(rn.decimal) + len(rn.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, rn.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, rn.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(rn.minus) - 1; j >= 0; j-- {
+ b = append(b, rn.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, rn.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ro/ro.go b/ro/ro.go
index 3dd4a8b7..89da15a9 100644
--- a/ro/ro.go
+++ b/ro/ro.go
@@ -255,3 +255,77 @@ func (ro *ro) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ro'
+// 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 (ro *ro) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ro.currencies[currency]
+ l := len(s) + len(ro.decimal) + len(ro.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ro.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ro.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ro.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ro.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ro.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ro.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ro.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ro_MD/ro_MD.go b/ro_MD/ro_MD.go
index a961c82e..1e98510f 100644
--- a/ro_MD/ro_MD.go
+++ b/ro_MD/ro_MD.go
@@ -255,3 +255,77 @@ func (ro *ro_MD) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ro_MD'
+// 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 (ro *ro_MD) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ro.currencies[currency]
+ l := len(s) + len(ro.decimal) + len(ro.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ro.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ro.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ro.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ro.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ro.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ro.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ro.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ro_RO/ro_RO.go b/ro_RO/ro_RO.go
index ab125f8d..a5a1e9a1 100644
--- a/ro_RO/ro_RO.go
+++ b/ro_RO/ro_RO.go
@@ -255,3 +255,77 @@ func (ro *ro_RO) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ro_RO'
+// 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 (ro *ro_RO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ro.currencies[currency]
+ l := len(s) + len(ro.decimal) + len(ro.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ro.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ro.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ro.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ro.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ro.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ro.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ro.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/rof/rof.go b/rof/rof.go
index 21268481..6916d19b 100644
--- a/rof/rof.go
+++ b/rof/rof.go
@@ -163,3 +163,79 @@ func (rof *rof) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'rof'
+// 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 (rof *rof) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := rof.currencies[currency]
+ l := len(s) + len(rof.decimal) + len(rof.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(rof.decimal) - 1; j >= 0; j-- {
+ b = append(b, rof.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(rof.group) - 1; j >= 0; j-- {
+ b = append(b, rof.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(rof.minus) - 1; j >= 0; j-- {
+ b = append(b, rof.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, rof.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/rof_TZ/rof_TZ.go b/rof_TZ/rof_TZ.go
index 7ae5e801..f158faec 100644
--- a/rof_TZ/rof_TZ.go
+++ b/rof_TZ/rof_TZ.go
@@ -163,3 +163,79 @@ func (rof *rof_TZ) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'rof_TZ'
+// 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 (rof *rof_TZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := rof.currencies[currency]
+ l := len(s) + len(rof.decimal) + len(rof.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(rof.decimal) - 1; j >= 0; j-- {
+ b = append(b, rof.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(rof.group) - 1; j >= 0; j-- {
+ b = append(b, rof.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(rof.minus) - 1; j >= 0; j-- {
+ b = append(b, rof.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, rof.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/root/root.go b/root/root.go
index 5fabc6f1..cd7b87b2 100644
--- a/root/root.go
+++ b/root/root.go
@@ -96,5 +96,15 @@ func (root *root) FmtCurrency(num float64, v uint64, currency currency.Type) []b
s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
symbol := root.currencies[currency]
- return []byte(s)
+ return append(append([]byte{}, symbol...), s...)
+}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'root'
+// 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 (root *root) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := root.currencies[currency]
+ return append(append([]byte{}, symbol...), s...)
}
diff --git a/ru/ru.go b/ru/ru.go
index 2ddbda7e..27cfc5c6 100644
--- a/ru/ru.go
+++ b/ru/ru.go
@@ -273,3 +273,78 @@ func (ru *ru) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ru'
+// 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 (ru *ru) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ru.currencies[currency]
+ l := len(s) + len(ru.decimal) + len(ru.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ru.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ru.group) - 1; j >= 0; j-- {
+ b = append(b, ru.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, ru.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ru.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ru.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ru.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ru_BY/ru_BY.go b/ru_BY/ru_BY.go
index f698fc68..c95fdd08 100644
--- a/ru_BY/ru_BY.go
+++ b/ru_BY/ru_BY.go
@@ -273,3 +273,78 @@ func (ru *ru_BY) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ru_BY'
+// 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 (ru *ru_BY) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ru.currencies[currency]
+ l := len(s) + len(ru.decimal) + len(ru.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ru.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ru.group) - 1; j >= 0; j-- {
+ b = append(b, ru.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, ru.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ru.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ru.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ru.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ru_KG/ru_KG.go b/ru_KG/ru_KG.go
index 748a7ca2..9140f2f3 100644
--- a/ru_KG/ru_KG.go
+++ b/ru_KG/ru_KG.go
@@ -66,8 +66,8 @@ func (ru *ru_KG) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
i := int64(n)
- iMod100 := i % 100
iMod10 := i % 10
+ iMod100 := i % 100
if v == 0 && iMod10 == 1 && iMod100 != 11 {
return locales.PluralRuleOne
@@ -273,3 +273,78 @@ func (ru *ru_KG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ru_KG'
+// 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 (ru *ru_KG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ru.currencies[currency]
+ l := len(s) + len(ru.decimal) + len(ru.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ru.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ru.group) - 1; j >= 0; j-- {
+ b = append(b, ru.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, ru.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ru.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ru.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ru.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ru_KZ/ru_KZ.go b/ru_KZ/ru_KZ.go
index 097b1003..a592ee7d 100644
--- a/ru_KZ/ru_KZ.go
+++ b/ru_KZ/ru_KZ.go
@@ -273,3 +273,78 @@ func (ru *ru_KZ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ru_KZ'
+// 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 (ru *ru_KZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ru.currencies[currency]
+ l := len(s) + len(ru.decimal) + len(ru.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ru.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ru.group) - 1; j >= 0; j-- {
+ b = append(b, ru.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, ru.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ru.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ru.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ru.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ru_MD/ru_MD.go b/ru_MD/ru_MD.go
index 25917cdc..718a469c 100644
--- a/ru_MD/ru_MD.go
+++ b/ru_MD/ru_MD.go
@@ -273,3 +273,78 @@ func (ru *ru_MD) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ru_MD'
+// 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 (ru *ru_MD) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ru.currencies[currency]
+ l := len(s) + len(ru.decimal) + len(ru.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ru.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ru.group) - 1; j >= 0; j-- {
+ b = append(b, ru.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, ru.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ru.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ru.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ru.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ru_RU/ru_RU.go b/ru_RU/ru_RU.go
index 29f9acd5..18689278 100644
--- a/ru_RU/ru_RU.go
+++ b/ru_RU/ru_RU.go
@@ -273,3 +273,78 @@ func (ru *ru_RU) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ru_RU'
+// 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 (ru *ru_RU) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ru.currencies[currency]
+ l := len(s) + len(ru.decimal) + len(ru.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ru.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ru.group) - 1; j >= 0; j-- {
+ b = append(b, ru.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, ru.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ru.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ru.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ru.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ru_UA/ru_UA.go b/ru_UA/ru_UA.go
index 5c960565..9973d564 100644
--- a/ru_UA/ru_UA.go
+++ b/ru_UA/ru_UA.go
@@ -273,3 +273,78 @@ func (ru *ru_UA) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ru_UA'
+// 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 (ru *ru_UA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ru.currencies[currency]
+ l := len(s) + len(ru.decimal) + len(ru.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ru.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ru.group) - 1; j >= 0; j-- {
+ b = append(b, ru.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, ru.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ru.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ru.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, ru.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/rules.go b/rules.go
index 4a9ff4cf..ef956287 100644
--- a/rules.go
+++ b/rules.go
@@ -76,6 +76,11 @@ type Translator interface {
// returned as a []byte just in case the caller wishes to add more and can help
// avoid allocations; otherwise just cast as string.
FmtCurrency(num float64, v uint64, currency currency.Type) []byte
+
+ // returns the currency representation of 'num' with digits/precision of 'v' for locale
+ // 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.
+ FmtAccounting(num float64, v uint64, currency currency.Type) []byte
}
// String returns the string value of PluralRule
diff --git a/rw/rw.go b/rw/rw.go
index 9d970471..2911dd47 100644
--- a/rw/rw.go
+++ b/rw/rw.go
@@ -141,3 +141,68 @@ func (rw *rw) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'rw'
+// 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 (rw *rw) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := rw.currencies[currency]
+ l := len(s) + len(rw.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, rw.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(rw.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, rw.currencyNegativePrefix[j])
+ }
+
+ for j := len(rw.minus) - 1; j >= 0; j-- {
+ b = append(b, rw.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(rw.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, rw.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, rw.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, rw.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/rw_RW/rw_RW.go b/rw_RW/rw_RW.go
index 785a910e..e51f9ac2 100644
--- a/rw_RW/rw_RW.go
+++ b/rw_RW/rw_RW.go
@@ -141,3 +141,68 @@ func (rw *rw_RW) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'rw_RW'
+// 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 (rw *rw_RW) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := rw.currencies[currency]
+ l := len(s) + len(rw.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, rw.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(rw.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, rw.currencyNegativePrefix[j])
+ }
+
+ for j := len(rw.minus) - 1; j >= 0; j-- {
+ b = append(b, rw.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(rw.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, rw.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, rw.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, rw.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/rwk/rwk.go b/rwk/rwk.go
index 86f87373..18512895 100644
--- a/rwk/rwk.go
+++ b/rwk/rwk.go
@@ -161,3 +161,79 @@ func (rwk *rwk) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'rwk'
+// 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 (rwk *rwk) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := rwk.currencies[currency]
+ l := len(s) + len(rwk.decimal) + len(rwk.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(rwk.decimal) - 1; j >= 0; j-- {
+ b = append(b, rwk.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(rwk.group) - 1; j >= 0; j-- {
+ b = append(b, rwk.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(rwk.minus) - 1; j >= 0; j-- {
+ b = append(b, rwk.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, rwk.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/rwk_TZ/rwk_TZ.go b/rwk_TZ/rwk_TZ.go
index b038d36b..5ed60b89 100644
--- a/rwk_TZ/rwk_TZ.go
+++ b/rwk_TZ/rwk_TZ.go
@@ -161,3 +161,79 @@ func (rwk *rwk_TZ) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'rwk_TZ'
+// 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 (rwk *rwk_TZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := rwk.currencies[currency]
+ l := len(s) + len(rwk.decimal) + len(rwk.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(rwk.decimal) - 1; j >= 0; j-- {
+ b = append(b, rwk.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(rwk.group) - 1; j >= 0; j-- {
+ b = append(b, rwk.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(rwk.minus) - 1; j >= 0; j-- {
+ b = append(b, rwk.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, rwk.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sah/sah.go b/sah/sah.go
index 1f399a17..2ab49915 100644
--- a/sah/sah.go
+++ b/sah/sah.go
@@ -141,3 +141,68 @@ func (sah *sah) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sah'
+// 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 (sah *sah) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sah.currencies[currency]
+ l := len(s) + len(sah.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sah.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(sah.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sah.currencyNegativePrefix[j])
+ }
+
+ for j := len(sah.minus) - 1; j >= 0; j-- {
+ b = append(b, sah.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(sah.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, sah.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, sah.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, sah.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/sah_RU/sah_RU.go b/sah_RU/sah_RU.go
index d18e5dad..aae7875e 100644
--- a/sah_RU/sah_RU.go
+++ b/sah_RU/sah_RU.go
@@ -141,3 +141,68 @@ func (sah *sah_RU) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sah_RU'
+// 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 (sah *sah_RU) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sah.currencies[currency]
+ l := len(s) + len(sah.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sah.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(sah.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sah.currencyNegativePrefix[j])
+ }
+
+ for j := len(sah.minus) - 1; j >= 0; j-- {
+ b = append(b, sah.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(sah.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, sah.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, sah.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, sah.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/saq/saq.go b/saq/saq.go
index 0fcd58d8..7a7c0860 100644
--- a/saq/saq.go
+++ b/saq/saq.go
@@ -167,3 +167,85 @@ func (saq *saq) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'saq'
+// 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 (saq *saq) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := saq.currencies[currency]
+ l := len(s) + len(saq.decimal) + len(saq.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(saq.decimal) - 1; j >= 0; j-- {
+ b = append(b, saq.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(saq.group) - 1; j >= 0; j-- {
+ b = append(b, saq.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(saq.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, saq.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, saq.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, saq.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/saq_KE/saq_KE.go b/saq_KE/saq_KE.go
index 7c0f193a..8a600395 100644
--- a/saq_KE/saq_KE.go
+++ b/saq_KE/saq_KE.go
@@ -167,3 +167,85 @@ func (saq *saq_KE) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'saq_KE'
+// 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 (saq *saq_KE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := saq.currencies[currency]
+ l := len(s) + len(saq.decimal) + len(saq.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(saq.decimal) - 1; j >= 0; j-- {
+ b = append(b, saq.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(saq.group) - 1; j >= 0; j-- {
+ b = append(b, saq.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(saq.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, saq.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, saq.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, saq.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/sbp/sbp.go b/sbp/sbp.go
index b34d57d6..4a94a454 100644
--- a/sbp/sbp.go
+++ b/sbp/sbp.go
@@ -212,3 +212,73 @@ func (sbp *sbp) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sbp'
+// 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 (sbp *sbp) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sbp.currencies[currency]
+ l := len(s) + len(sbp.decimal) + len(sbp.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sbp.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sbp.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sbp.minus) - 1; j >= 0; j-- {
+ b = append(b, sbp.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sbp.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sbp_TZ/sbp_TZ.go b/sbp_TZ/sbp_TZ.go
index d1247d4b..906610f7 100644
--- a/sbp_TZ/sbp_TZ.go
+++ b/sbp_TZ/sbp_TZ.go
@@ -212,3 +212,73 @@ func (sbp *sbp_TZ) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sbp_TZ'
+// 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 (sbp *sbp_TZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sbp.currencies[currency]
+ l := len(s) + len(sbp.decimal) + len(sbp.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sbp.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sbp.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sbp.minus) - 1; j >= 0; j-- {
+ b = append(b, sbp.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sbp.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/se/se.go b/se/se.go
index 2f13f92b..56bf0daf 100644
--- a/se/se.go
+++ b/se/se.go
@@ -237,3 +237,80 @@ func (se *se) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'se'
+// 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 (se *se) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := se.currencies[currency]
+ l := len(s) + len(se.decimal) + len(se.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, se.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(se.group) - 1; j >= 0; j-- {
+ b = append(b, se.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(se.minus) - 1; j >= 0; j-- {
+ b = append(b, se.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, se.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, se.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, se.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/se_FI/se_FI.go b/se_FI/se_FI.go
index 1e33ca69..acd551c8 100644
--- a/se_FI/se_FI.go
+++ b/se_FI/se_FI.go
@@ -237,3 +237,80 @@ func (se *se_FI) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'se_FI'
+// 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 (se *se_FI) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := se.currencies[currency]
+ l := len(s) + len(se.decimal) + len(se.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, se.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(se.group) - 1; j >= 0; j-- {
+ b = append(b, se.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(se.minus) - 1; j >= 0; j-- {
+ b = append(b, se.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, se.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, se.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, se.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/se_NO/se_NO.go b/se_NO/se_NO.go
index e08841d0..ccd20ac6 100644
--- a/se_NO/se_NO.go
+++ b/se_NO/se_NO.go
@@ -237,3 +237,80 @@ func (se *se_NO) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'se_NO'
+// 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 (se *se_NO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := se.currencies[currency]
+ l := len(s) + len(se.decimal) + len(se.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, se.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(se.group) - 1; j >= 0; j-- {
+ b = append(b, se.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(se.minus) - 1; j >= 0; j-- {
+ b = append(b, se.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, se.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, se.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, se.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/se_SE/se_SE.go b/se_SE/se_SE.go
index 5604be23..973f3e9e 100644
--- a/se_SE/se_SE.go
+++ b/se_SE/se_SE.go
@@ -237,3 +237,80 @@ func (se *se_SE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'se_SE'
+// 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 (se *se_SE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := se.currencies[currency]
+ l := len(s) + len(se.decimal) + len(se.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, se.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(se.group) - 1; j >= 0; j-- {
+ b = append(b, se.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(se.minus) - 1; j >= 0; j-- {
+ b = append(b, se.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, se.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, se.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, se.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/seh/seh.go b/seh/seh.go
index d9b3bdab..1c1d29d5 100644
--- a/seh/seh.go
+++ b/seh/seh.go
@@ -155,3 +155,73 @@ func (seh *seh) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'seh'
+// 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 (seh *seh) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := seh.currencies[currency]
+ l := len(s) + len(seh.decimal) + len(seh.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, seh.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, seh.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(seh.minus) - 1; j >= 0; j-- {
+ b = append(b, seh.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, seh.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/seh_MZ/seh_MZ.go b/seh_MZ/seh_MZ.go
index 62057d5a..0f298cf9 100644
--- a/seh_MZ/seh_MZ.go
+++ b/seh_MZ/seh_MZ.go
@@ -155,3 +155,73 @@ func (seh *seh_MZ) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'seh_MZ'
+// 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 (seh *seh_MZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := seh.currencies[currency]
+ l := len(s) + len(seh.decimal) + len(seh.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, seh.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, seh.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(seh.minus) - 1; j >= 0; j-- {
+ b = append(b, seh.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, seh.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ses/ses.go b/ses/ses.go
index 4b08fc3c..30bd042a 100644
--- a/ses/ses.go
+++ b/ses/ses.go
@@ -154,3 +154,79 @@ func (ses *ses) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ses'
+// 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 (ses *ses) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ses.currencies[currency]
+ l := len(s) + len(ses.decimal) + len(ses.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ses.decimal) - 1; j >= 0; j-- {
+ b = append(b, ses.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ses.group) - 1; j >= 0; j-- {
+ b = append(b, ses.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ses.minus) - 1; j >= 0; j-- {
+ b = append(b, ses.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ses.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ses_ML/ses_ML.go b/ses_ML/ses_ML.go
index e2336cf8..b5ee1cae 100644
--- a/ses_ML/ses_ML.go
+++ b/ses_ML/ses_ML.go
@@ -154,3 +154,79 @@ func (ses *ses_ML) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ses_ML'
+// 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 (ses *ses_ML) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ses.currencies[currency]
+ l := len(s) + len(ses.decimal) + len(ses.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ses.decimal) - 1; j >= 0; j-- {
+ b = append(b, ses.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ses.group) - 1; j >= 0; j-- {
+ b = append(b, ses.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(ses.minus) - 1; j >= 0; j-- {
+ b = append(b, ses.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ses.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sg/sg.go b/sg/sg.go
index 81de95ee..7c6d2dab 100644
--- a/sg/sg.go
+++ b/sg/sg.go
@@ -150,3 +150,73 @@ func (sg *sg) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sg'
+// 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 (sg *sg) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sg.currencies[currency]
+ l := len(s) + len(sg.decimal) + len(sg.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sg.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sg.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(sg.minus) - 1; j >= 0; j-- {
+ b = append(b, sg.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sg.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/sg_CF/sg_CF.go b/sg_CF/sg_CF.go
index e01356ce..f65d67ee 100644
--- a/sg_CF/sg_CF.go
+++ b/sg_CF/sg_CF.go
@@ -150,3 +150,73 @@ func (sg *sg_CF) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sg_CF'
+// 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 (sg *sg_CF) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sg.currencies[currency]
+ l := len(s) + len(sg.decimal) + len(sg.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sg.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sg.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(sg.minus) - 1; j >= 0; j-- {
+ b = append(b, sg.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sg.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/shi/shi.go b/shi/shi.go
index 47c92846..5cf548ec 100644
--- a/shi/shi.go
+++ b/shi/shi.go
@@ -161,3 +161,76 @@ func (shi *shi) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'shi'
+// 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 (shi *shi) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := shi.currencies[currency]
+ l := len(s) + len(shi.decimal) + len(shi.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, shi.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(shi.group) - 1; j >= 0; j-- {
+ b = append(b, shi.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(shi.minus) - 1; j >= 0; j-- {
+ b = append(b, shi.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, shi.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/shi_Latn/shi_Latn.go b/shi_Latn/shi_Latn.go
index 02fb41c8..a4f00380 100644
--- a/shi_Latn/shi_Latn.go
+++ b/shi_Latn/shi_Latn.go
@@ -161,3 +161,76 @@ func (shi *shi_Latn) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'shi_Latn'
+// 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 (shi *shi_Latn) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := shi.currencies[currency]
+ l := len(s) + len(shi.decimal) + len(shi.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, shi.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(shi.group) - 1; j >= 0; j-- {
+ b = append(b, shi.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(shi.minus) - 1; j >= 0; j-- {
+ b = append(b, shi.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, shi.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/shi_Latn_MA/shi_Latn_MA.go b/shi_Latn_MA/shi_Latn_MA.go
index 0237d2d7..90192032 100644
--- a/shi_Latn_MA/shi_Latn_MA.go
+++ b/shi_Latn_MA/shi_Latn_MA.go
@@ -161,3 +161,76 @@ func (shi *shi_Latn_MA) FmtCurrency(num float64, v uint64, currency currency.Typ
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'shi_Latn_MA'
+// 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 (shi *shi_Latn_MA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := shi.currencies[currency]
+ l := len(s) + len(shi.decimal) + len(shi.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, shi.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(shi.group) - 1; j >= 0; j-- {
+ b = append(b, shi.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(shi.minus) - 1; j >= 0; j-- {
+ b = append(b, shi.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, shi.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/shi_Tfng/shi_Tfng.go b/shi_Tfng/shi_Tfng.go
index 7bf7eb98..43de7584 100644
--- a/shi_Tfng/shi_Tfng.go
+++ b/shi_Tfng/shi_Tfng.go
@@ -161,3 +161,76 @@ func (shi *shi_Tfng) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'shi_Tfng'
+// 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 (shi *shi_Tfng) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := shi.currencies[currency]
+ l := len(s) + len(shi.decimal) + len(shi.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, shi.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(shi.group) - 1; j >= 0; j-- {
+ b = append(b, shi.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(shi.minus) - 1; j >= 0; j-- {
+ b = append(b, shi.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, shi.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/shi_Tfng_MA/shi_Tfng_MA.go b/shi_Tfng_MA/shi_Tfng_MA.go
index 15a6aa54..a645a38e 100644
--- a/shi_Tfng_MA/shi_Tfng_MA.go
+++ b/shi_Tfng_MA/shi_Tfng_MA.go
@@ -161,3 +161,76 @@ func (shi *shi_Tfng_MA) FmtCurrency(num float64, v uint64, currency currency.Typ
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'shi_Tfng_MA'
+// 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 (shi *shi_Tfng_MA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := shi.currencies[currency]
+ l := len(s) + len(shi.decimal) + len(shi.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, shi.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(shi.group) - 1; j >= 0; j-- {
+ b = append(b, shi.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(shi.minus) - 1; j >= 0; j-- {
+ b = append(b, shi.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, shi.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/si/si.go b/si/si.go
index def8b581..7fbf69cb 100644
--- a/si/si.go
+++ b/si/si.go
@@ -234,3 +234,79 @@ func (si *si) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'si'
+// 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 (si *si) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := si.currencies[currency]
+ l := len(s) + len(si.decimal) + len(si.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, si.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, si.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(si.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, si.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, si.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, si.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/si_LK/si_LK.go b/si_LK/si_LK.go
index 67d1f844..09c7643e 100644
--- a/si_LK/si_LK.go
+++ b/si_LK/si_LK.go
@@ -234,3 +234,79 @@ func (si *si_LK) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'si_LK'
+// 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 (si *si_LK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := si.currencies[currency]
+ l := len(s) + len(si.decimal) + len(si.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, si.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, si.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(si.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, si.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, si.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, si.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/sk/sk.go b/sk/sk.go
index 800cad8e..e5c83086 100644
--- a/sk/sk.go
+++ b/sk/sk.go
@@ -269,3 +269,80 @@ func (sk *sk) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sk'
+// 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 (sk *sk) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sk.currencies[currency]
+ l := len(s) + len(sk.decimal) + len(sk.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sk.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(sk.group) - 1; j >= 0; j-- {
+ b = append(b, sk.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sk.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sk.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sk.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sk.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sk.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sk_SK/sk_SK.go b/sk_SK/sk_SK.go
index 2c5c3ab1..6d683cf0 100644
--- a/sk_SK/sk_SK.go
+++ b/sk_SK/sk_SK.go
@@ -269,3 +269,80 @@ func (sk *sk_SK) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sk_SK'
+// 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 (sk *sk_SK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sk.currencies[currency]
+ l := len(s) + len(sk.decimal) + len(sk.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sk.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(sk.group) - 1; j >= 0; j-- {
+ b = append(b, sk.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sk.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sk.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sk.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sk.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sk.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sl/sl.go b/sl/sl.go
index 640065da..af99c4ec 100644
--- a/sl/sl.go
+++ b/sl/sl.go
@@ -264,3 +264,77 @@ func (sl *sl) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sl'
+// 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 (sl *sl) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sl.currencies[currency]
+ l := len(s) + len(sl.decimal) + len(sl.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sl.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sl.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sl.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sl.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sl.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sl.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sl.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sl_SI/sl_SI.go b/sl_SI/sl_SI.go
index 40d247cf..c0d30789 100644
--- a/sl_SI/sl_SI.go
+++ b/sl_SI/sl_SI.go
@@ -264,3 +264,77 @@ func (sl *sl_SI) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sl_SI'
+// 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 (sl *sl_SI) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sl.currencies[currency]
+ l := len(s) + len(sl.decimal) + len(sl.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sl.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sl.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sl.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sl.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sl.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sl.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sl.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/smn/smn.go b/smn/smn.go
index 6dcc729a..e3b41d3d 100644
--- a/smn/smn.go
+++ b/smn/smn.go
@@ -153,3 +153,71 @@ func (smn *smn) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'smn'
+// 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 (smn *smn) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := smn.currencies[currency]
+ l := len(s) + len(smn.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(smn.decimal) - 1; j >= 0; j-- {
+ b = append(b, smn.decimal[j])
+ }
+
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(smn.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, smn.currencyNegativePrefix[j])
+ }
+
+ for j := len(smn.minus) - 1; j >= 0; j-- {
+ b = append(b, smn.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(smn.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, smn.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, smn.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, smn.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/smn_FI/smn_FI.go b/smn_FI/smn_FI.go
index 1b9ef6b4..ae17c704 100644
--- a/smn_FI/smn_FI.go
+++ b/smn_FI/smn_FI.go
@@ -153,3 +153,71 @@ func (smn *smn_FI) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'smn_FI'
+// 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 (smn *smn_FI) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := smn.currencies[currency]
+ l := len(s) + len(smn.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(smn.decimal) - 1; j >= 0; j-- {
+ b = append(b, smn.decimal[j])
+ }
+
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(smn.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, smn.currencyNegativePrefix[j])
+ }
+
+ for j := len(smn.minus) - 1; j >= 0; j-- {
+ b = append(b, smn.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(smn.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, smn.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, smn.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, smn.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/sn/sn.go b/sn/sn.go
index 25ec62c6..3a14bc4d 100644
--- a/sn/sn.go
+++ b/sn/sn.go
@@ -167,3 +167,85 @@ func (sn *sn) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sn'
+// 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 (sn *sn) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sn.currencies[currency]
+ l := len(s) + len(sn.decimal) + len(sn.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(sn.decimal) - 1; j >= 0; j-- {
+ b = append(b, sn.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(sn.group) - 1; j >= 0; j-- {
+ b = append(b, sn.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(sn.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sn.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sn.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sn.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/sn_ZW/sn_ZW.go b/sn_ZW/sn_ZW.go
index ad7c89f2..8fa226ad 100644
--- a/sn_ZW/sn_ZW.go
+++ b/sn_ZW/sn_ZW.go
@@ -167,3 +167,85 @@ func (sn *sn_ZW) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sn_ZW'
+// 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 (sn *sn_ZW) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sn.currencies[currency]
+ l := len(s) + len(sn.decimal) + len(sn.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(sn.decimal) - 1; j >= 0; j-- {
+ b = append(b, sn.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(sn.group) - 1; j >= 0; j-- {
+ b = append(b, sn.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(sn.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sn.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sn.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sn.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/so/so.go b/so/so.go
index a3b5ad86..ac278e09 100644
--- a/so/so.go
+++ b/so/so.go
@@ -157,3 +157,73 @@ func (so *so) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'so'
+// 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 (so *so) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := so.currencies[currency]
+ l := len(s) + len(so.decimal) + len(so.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, so.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, so.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(so.minus) - 1; j >= 0; j-- {
+ b = append(b, so.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, so.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/so_DJ/so_DJ.go b/so_DJ/so_DJ.go
index 08144099..e8de418a 100644
--- a/so_DJ/so_DJ.go
+++ b/so_DJ/so_DJ.go
@@ -157,3 +157,73 @@ func (so *so_DJ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'so_DJ'
+// 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 (so *so_DJ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := so.currencies[currency]
+ l := len(s) + len(so.decimal) + len(so.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, so.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, so.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(so.minus) - 1; j >= 0; j-- {
+ b = append(b, so.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, so.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/so_ET/so_ET.go b/so_ET/so_ET.go
index 0d97b75b..8e25fd6c 100644
--- a/so_ET/so_ET.go
+++ b/so_ET/so_ET.go
@@ -157,3 +157,73 @@ func (so *so_ET) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'so_ET'
+// 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 (so *so_ET) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := so.currencies[currency]
+ l := len(s) + len(so.decimal) + len(so.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, so.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, so.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(so.minus) - 1; j >= 0; j-- {
+ b = append(b, so.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, so.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/so_KE/so_KE.go b/so_KE/so_KE.go
index 5bca8411..6027c7f3 100644
--- a/so_KE/so_KE.go
+++ b/so_KE/so_KE.go
@@ -157,3 +157,73 @@ func (so *so_KE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'so_KE'
+// 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 (so *so_KE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := so.currencies[currency]
+ l := len(s) + len(so.decimal) + len(so.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, so.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, so.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(so.minus) - 1; j >= 0; j-- {
+ b = append(b, so.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, so.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/so_SO/so_SO.go b/so_SO/so_SO.go
index 1f7c2bcd..95eb11fb 100644
--- a/so_SO/so_SO.go
+++ b/so_SO/so_SO.go
@@ -157,3 +157,73 @@ func (so *so_SO) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'so_SO'
+// 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 (so *so_SO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := so.currencies[currency]
+ l := len(s) + len(so.decimal) + len(so.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, so.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, so.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(so.minus) - 1; j >= 0; j-- {
+ b = append(b, so.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, so.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/sq/sq.go b/sq/sq.go
index 28e5e566..98426090 100644
--- a/sq/sq.go
+++ b/sq/sq.go
@@ -249,3 +249,80 @@ func (sq *sq) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sq'
+// 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 (sq *sq) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sq.currencies[currency]
+ l := len(s) + len(sq.decimal) + len(sq.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sq.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(sq.group) - 1; j >= 0; j-- {
+ b = append(b, sq.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sq.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sq.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sq.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sq.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sq.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sq_AL/sq_AL.go b/sq_AL/sq_AL.go
index fb3d7b74..ffa873d1 100644
--- a/sq_AL/sq_AL.go
+++ b/sq_AL/sq_AL.go
@@ -77,8 +77,8 @@ func (sq *sq_AL) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (sq *sq_AL) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod10 := math.Mod(n, 10)
nMod100 := math.Mod(n, 100)
+ nMod10 := math.Mod(n, 10)
if n == 1 {
return locales.PluralRuleOne
@@ -249,3 +249,80 @@ func (sq *sq_AL) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sq_AL'
+// 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 (sq *sq_AL) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sq.currencies[currency]
+ l := len(s) + len(sq.decimal) + len(sq.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sq.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(sq.group) - 1; j >= 0; j-- {
+ b = append(b, sq.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sq.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sq.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sq.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sq.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sq.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sq_MK/sq_MK.go b/sq_MK/sq_MK.go
index 3090e097..475baf9e 100644
--- a/sq_MK/sq_MK.go
+++ b/sq_MK/sq_MK.go
@@ -249,3 +249,80 @@ func (sq *sq_MK) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sq_MK'
+// 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 (sq *sq_MK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sq.currencies[currency]
+ l := len(s) + len(sq.decimal) + len(sq.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sq.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(sq.group) - 1; j >= 0; j-- {
+ b = append(b, sq.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sq.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sq.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sq.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sq.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sq.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sq_XK/sq_XK.go b/sq_XK/sq_XK.go
index 7ea8832c..b1f35965 100644
--- a/sq_XK/sq_XK.go
+++ b/sq_XK/sq_XK.go
@@ -249,3 +249,80 @@ func (sq *sq_XK) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sq_XK'
+// 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 (sq *sq_XK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sq.currencies[currency]
+ l := len(s) + len(sq.decimal) + len(sq.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sq.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(sq.group) - 1; j >= 0; j-- {
+ b = append(b, sq.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sq.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sq.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sq.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sq.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sq.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sr/sr.go b/sr/sr.go
index 11eecda7..fbf51f30 100644
--- a/sr/sr.go
+++ b/sr/sr.go
@@ -252,3 +252,77 @@ func (sr *sr) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sr'
+// 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 (sr *sr) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sr.currencies[currency]
+ l := len(s) + len(sr.decimal) + len(sr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sr_Cyrl/sr_Cyrl.go b/sr_Cyrl/sr_Cyrl.go
index 6c9fc946..26db7516 100644
--- a/sr_Cyrl/sr_Cyrl.go
+++ b/sr_Cyrl/sr_Cyrl.go
@@ -67,10 +67,10 @@ func (sr *sr_Cyrl) CardinalPluralRule(num float64, v uint64) locales.PluralRule
n := math.Abs(num)
i := int64(n)
f := locales.F(n, v)
- iMod100 := i % 100
iMod10 := i % 10
- fMod100 := f % 100
+ iMod100 := i % 100
fMod10 := f % 10
+ fMod100 := f % 100
if (v == 0 && iMod10 == 1 && iMod100 != 11) || (fMod10 == 1 && fMod100 != 11) {
return locales.PluralRuleOne
@@ -252,3 +252,77 @@ func (sr *sr_Cyrl) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sr_Cyrl'
+// 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 (sr *sr_Cyrl) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sr.currencies[currency]
+ l := len(s) + len(sr.decimal) + len(sr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sr_Cyrl_BA/sr_Cyrl_BA.go b/sr_Cyrl_BA/sr_Cyrl_BA.go
index a79278fd..b4f0abe0 100644
--- a/sr_Cyrl_BA/sr_Cyrl_BA.go
+++ b/sr_Cyrl_BA/sr_Cyrl_BA.go
@@ -252,3 +252,77 @@ func (sr *sr_Cyrl_BA) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sr_Cyrl_BA'
+// 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 (sr *sr_Cyrl_BA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sr.currencies[currency]
+ l := len(s) + len(sr.decimal) + len(sr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sr_Cyrl_ME/sr_Cyrl_ME.go b/sr_Cyrl_ME/sr_Cyrl_ME.go
index b0f76259..9ae6cf5a 100644
--- a/sr_Cyrl_ME/sr_Cyrl_ME.go
+++ b/sr_Cyrl_ME/sr_Cyrl_ME.go
@@ -67,10 +67,10 @@ func (sr *sr_Cyrl_ME) CardinalPluralRule(num float64, v uint64) locales.PluralRu
n := math.Abs(num)
i := int64(n)
f := locales.F(n, v)
- iMod10 := i % 10
iMod100 := i % 100
- fMod100 := f % 100
+ iMod10 := i % 10
fMod10 := f % 10
+ fMod100 := f % 100
if (v == 0 && iMod10 == 1 && iMod100 != 11) || (fMod10 == 1 && fMod100 != 11) {
return locales.PluralRuleOne
@@ -252,3 +252,77 @@ func (sr *sr_Cyrl_ME) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sr_Cyrl_ME'
+// 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 (sr *sr_Cyrl_ME) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sr.currencies[currency]
+ l := len(s) + len(sr.decimal) + len(sr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sr_Cyrl_RS/sr_Cyrl_RS.go b/sr_Cyrl_RS/sr_Cyrl_RS.go
index 10145cdb..a526fb81 100644
--- a/sr_Cyrl_RS/sr_Cyrl_RS.go
+++ b/sr_Cyrl_RS/sr_Cyrl_RS.go
@@ -252,3 +252,77 @@ func (sr *sr_Cyrl_RS) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sr_Cyrl_RS'
+// 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 (sr *sr_Cyrl_RS) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sr.currencies[currency]
+ l := len(s) + len(sr.decimal) + len(sr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sr_Cyrl_XK/sr_Cyrl_XK.go b/sr_Cyrl_XK/sr_Cyrl_XK.go
index 09a418ab..3c8aebe6 100644
--- a/sr_Cyrl_XK/sr_Cyrl_XK.go
+++ b/sr_Cyrl_XK/sr_Cyrl_XK.go
@@ -67,8 +67,8 @@ func (sr *sr_Cyrl_XK) CardinalPluralRule(num float64, v uint64) locales.PluralRu
n := math.Abs(num)
i := int64(n)
f := locales.F(n, v)
- iMod100 := i % 100
iMod10 := i % 10
+ iMod100 := i % 100
fMod10 := f % 10
fMod100 := f % 100
@@ -252,3 +252,77 @@ func (sr *sr_Cyrl_XK) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sr_Cyrl_XK'
+// 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 (sr *sr_Cyrl_XK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sr.currencies[currency]
+ l := len(s) + len(sr.decimal) + len(sr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sr_Latn/sr_Latn.go b/sr_Latn/sr_Latn.go
index 732f1641..29d0fe6c 100644
--- a/sr_Latn/sr_Latn.go
+++ b/sr_Latn/sr_Latn.go
@@ -252,3 +252,77 @@ func (sr *sr_Latn) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sr_Latn'
+// 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 (sr *sr_Latn) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sr.currencies[currency]
+ l := len(s) + len(sr.decimal) + len(sr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sr_Latn_BA/sr_Latn_BA.go b/sr_Latn_BA/sr_Latn_BA.go
index 69d3a8ce..2daaacc7 100644
--- a/sr_Latn_BA/sr_Latn_BA.go
+++ b/sr_Latn_BA/sr_Latn_BA.go
@@ -67,10 +67,10 @@ func (sr *sr_Latn_BA) CardinalPluralRule(num float64, v uint64) locales.PluralRu
n := math.Abs(num)
i := int64(n)
f := locales.F(n, v)
- iMod10 := i % 10
iMod100 := i % 100
- fMod10 := f % 10
+ iMod10 := i % 10
fMod100 := f % 100
+ fMod10 := f % 10
if (v == 0 && iMod10 == 1 && iMod100 != 11) || (fMod10 == 1 && fMod100 != 11) {
return locales.PluralRuleOne
@@ -252,3 +252,77 @@ func (sr *sr_Latn_BA) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sr_Latn_BA'
+// 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 (sr *sr_Latn_BA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sr.currencies[currency]
+ l := len(s) + len(sr.decimal) + len(sr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sr_Latn_ME/sr_Latn_ME.go b/sr_Latn_ME/sr_Latn_ME.go
index 27d8acd7..e5ed125e 100644
--- a/sr_Latn_ME/sr_Latn_ME.go
+++ b/sr_Latn_ME/sr_Latn_ME.go
@@ -252,3 +252,77 @@ func (sr *sr_Latn_ME) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sr_Latn_ME'
+// 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 (sr *sr_Latn_ME) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sr.currencies[currency]
+ l := len(s) + len(sr.decimal) + len(sr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sr_Latn_RS/sr_Latn_RS.go b/sr_Latn_RS/sr_Latn_RS.go
index 7796c007..91f9b84d 100644
--- a/sr_Latn_RS/sr_Latn_RS.go
+++ b/sr_Latn_RS/sr_Latn_RS.go
@@ -252,3 +252,77 @@ func (sr *sr_Latn_RS) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sr_Latn_RS'
+// 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 (sr *sr_Latn_RS) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sr.currencies[currency]
+ l := len(s) + len(sr.decimal) + len(sr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sr_Latn_XK/sr_Latn_XK.go b/sr_Latn_XK/sr_Latn_XK.go
index 85b03637..c4e7c8d8 100644
--- a/sr_Latn_XK/sr_Latn_XK.go
+++ b/sr_Latn_XK/sr_Latn_XK.go
@@ -69,8 +69,8 @@ func (sr *sr_Latn_XK) CardinalPluralRule(num float64, v uint64) locales.PluralRu
f := locales.F(n, v)
iMod10 := i % 10
iMod100 := i % 100
- fMod10 := f % 10
fMod100 := f % 100
+ fMod10 := f % 10
if (v == 0 && iMod10 == 1 && iMod100 != 11) || (fMod10 == 1 && fMod100 != 11) {
return locales.PluralRuleOne
@@ -252,3 +252,77 @@ func (sr *sr_Latn_XK) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sr_Latn_XK'
+// 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 (sr *sr_Latn_XK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sr.currencies[currency]
+ l := len(s) + len(sr.decimal) + len(sr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sv/sv.go b/sv/sv.go
index 202a75e9..cad93d53 100644
--- a/sv/sv.go
+++ b/sv/sv.go
@@ -78,8 +78,8 @@ func (sv *sv) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (sv *sv) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod10 := math.Mod(n, 10)
nMod100 := math.Mod(n, 100)
+ nMod10 := math.Mod(n, 10)
if (nMod10 == 1 || nMod10 == 2) && (nMod100 != 11 && nMod100 != 12) {
return locales.PluralRuleOne
@@ -254,3 +254,83 @@ func (sv *sv) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sv'
+// 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 (sv *sv) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sv.currencies[currency]
+ l := len(s) + len(sv.decimal) + len(sv.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(sv.decimal) - 1; j >= 0; j-- {
+ b = append(b, sv.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(sv.group) - 1; j >= 0; j-- {
+ b = append(b, sv.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sv.minus) - 1; j >= 0; j-- {
+ b = append(b, sv.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sv.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sv.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sv.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sv_AX/sv_AX.go b/sv_AX/sv_AX.go
index e99de9d1..a48d09ed 100644
--- a/sv_AX/sv_AX.go
+++ b/sv_AX/sv_AX.go
@@ -254,3 +254,83 @@ func (sv *sv_AX) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sv_AX'
+// 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 (sv *sv_AX) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sv.currencies[currency]
+ l := len(s) + len(sv.decimal) + len(sv.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(sv.decimal) - 1; j >= 0; j-- {
+ b = append(b, sv.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(sv.group) - 1; j >= 0; j-- {
+ b = append(b, sv.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sv.minus) - 1; j >= 0; j-- {
+ b = append(b, sv.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sv.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sv.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sv.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sv_FI/sv_FI.go b/sv_FI/sv_FI.go
index a21bcb2a..fdb99e82 100644
--- a/sv_FI/sv_FI.go
+++ b/sv_FI/sv_FI.go
@@ -78,8 +78,8 @@ func (sv *sv_FI) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (sv *sv_FI) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod10 := math.Mod(n, 10)
nMod100 := math.Mod(n, 100)
+ nMod10 := math.Mod(n, 10)
if (nMod10 == 1 || nMod10 == 2) && (nMod100 != 11 && nMod100 != 12) {
return locales.PluralRuleOne
@@ -254,3 +254,83 @@ func (sv *sv_FI) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sv_FI'
+// 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 (sv *sv_FI) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sv.currencies[currency]
+ l := len(s) + len(sv.decimal) + len(sv.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(sv.decimal) - 1; j >= 0; j-- {
+ b = append(b, sv.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(sv.group) - 1; j >= 0; j-- {
+ b = append(b, sv.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sv.minus) - 1; j >= 0; j-- {
+ b = append(b, sv.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sv.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sv.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sv.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sv_SE/sv_SE.go b/sv_SE/sv_SE.go
index fa7964fc..02342f13 100644
--- a/sv_SE/sv_SE.go
+++ b/sv_SE/sv_SE.go
@@ -254,3 +254,83 @@ func (sv *sv_SE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sv_SE'
+// 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 (sv *sv_SE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sv.currencies[currency]
+ l := len(s) + len(sv.decimal) + len(sv.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(sv.decimal) - 1; j >= 0; j-- {
+ b = append(b, sv.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(sv.group) - 1; j >= 0; j-- {
+ b = append(b, sv.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(sv.minus) - 1; j >= 0; j-- {
+ b = append(b, sv.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sv.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sv.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, sv.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/sw/sw.go b/sw/sw.go
index 2cdec774..fe643165 100644
--- a/sw/sw.go
+++ b/sw/sw.go
@@ -231,3 +231,79 @@ func (sw *sw) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sw'
+// 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 (sw *sw) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sw.currencies[currency]
+ l := len(s) + len(sw.decimal) + len(sw.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sw.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sw.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(sw.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sw.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sw.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sw.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/sw_CD/sw_CD.go b/sw_CD/sw_CD.go
index 5f3b6e79..1d1bb9cb 100644
--- a/sw_CD/sw_CD.go
+++ b/sw_CD/sw_CD.go
@@ -231,3 +231,79 @@ func (sw *sw_CD) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sw_CD'
+// 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 (sw *sw_CD) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sw.currencies[currency]
+ l := len(s) + len(sw.decimal) + len(sw.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sw.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sw.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(sw.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sw.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sw.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sw.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/sw_KE/sw_KE.go b/sw_KE/sw_KE.go
index ca5385ed..8e79f77a 100644
--- a/sw_KE/sw_KE.go
+++ b/sw_KE/sw_KE.go
@@ -231,3 +231,79 @@ func (sw *sw_KE) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sw_KE'
+// 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 (sw *sw_KE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sw.currencies[currency]
+ l := len(s) + len(sw.decimal) + len(sw.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sw.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sw.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(sw.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sw.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sw.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sw.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/sw_TZ/sw_TZ.go b/sw_TZ/sw_TZ.go
index 501c2bc1..4206fa13 100644
--- a/sw_TZ/sw_TZ.go
+++ b/sw_TZ/sw_TZ.go
@@ -231,3 +231,79 @@ func (sw *sw_TZ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sw_TZ'
+// 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 (sw *sw_TZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sw.currencies[currency]
+ l := len(s) + len(sw.decimal) + len(sw.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sw.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sw.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(sw.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sw.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sw.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sw.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/sw_UG/sw_UG.go b/sw_UG/sw_UG.go
index 8e29890b..905ceb8a 100644
--- a/sw_UG/sw_UG.go
+++ b/sw_UG/sw_UG.go
@@ -231,3 +231,79 @@ func (sw *sw_UG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'sw_UG'
+// 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 (sw *sw_UG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := sw.currencies[currency]
+ l := len(s) + len(sw.decimal) + len(sw.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, sw.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, sw.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(sw.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, sw.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, sw.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, sw.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ta/ta.go b/ta/ta.go
index c1d86f91..cad77188 100644
--- a/ta/ta.go
+++ b/ta/ta.go
@@ -239,3 +239,79 @@ func (ta *ta) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ta'
+// 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 (ta *ta) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ta.currencies[currency]
+ l := len(s) + len(ta.decimal) + len(ta.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ta.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ta.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ta.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ta.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ta.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ta.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ta_IN/ta_IN.go b/ta_IN/ta_IN.go
index 3313af85..a523e603 100644
--- a/ta_IN/ta_IN.go
+++ b/ta_IN/ta_IN.go
@@ -239,3 +239,79 @@ func (ta *ta_IN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ta_IN'
+// 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 (ta *ta_IN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ta.currencies[currency]
+ l := len(s) + len(ta.decimal) + len(ta.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ta.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ta.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ta.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ta.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ta.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ta.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ta_LK/ta_LK.go b/ta_LK/ta_LK.go
index 700477b4..9fac52ba 100644
--- a/ta_LK/ta_LK.go
+++ b/ta_LK/ta_LK.go
@@ -239,3 +239,79 @@ func (ta *ta_LK) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ta_LK'
+// 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 (ta *ta_LK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ta.currencies[currency]
+ l := len(s) + len(ta.decimal) + len(ta.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ta.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ta.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ta.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ta.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ta.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ta.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ta_MY/ta_MY.go b/ta_MY/ta_MY.go
index 85be3e5c..11d73a92 100644
--- a/ta_MY/ta_MY.go
+++ b/ta_MY/ta_MY.go
@@ -234,3 +234,79 @@ func (ta *ta_MY) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ta_MY'
+// 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 (ta *ta_MY) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ta.currencies[currency]
+ l := len(s) + len(ta.decimal) + len(ta.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ta.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ta.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ta.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ta.currencyNegativePrefix[j])
+ }
+
+ b = append(b, ta.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ta.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ta.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ta.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ta_SG/ta_SG.go b/ta_SG/ta_SG.go
index df044b33..a50a31a9 100644
--- a/ta_SG/ta_SG.go
+++ b/ta_SG/ta_SG.go
@@ -234,3 +234,79 @@ func (ta *ta_SG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ta_SG'
+// 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 (ta *ta_SG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ta.currencies[currency]
+ l := len(s) + len(ta.decimal) + len(ta.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ta.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ta.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ta.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ta.currencyNegativePrefix[j])
+ }
+
+ b = append(b, ta.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ta.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ta.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ta.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/te/te.go b/te/te.go
index d211861f..c4dcf448 100644
--- a/te/te.go
+++ b/te/te.go
@@ -248,3 +248,88 @@ func (te *te) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'te'
+// 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 (te *te) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := te.currencies[currency]
+ l := len(s) + len(te.decimal) + len(te.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, te.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ b = append(b, te.group[0])
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(te.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, te.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, te.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, te.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/te_IN/te_IN.go b/te_IN/te_IN.go
index 44d94b87..0241b333 100644
--- a/te_IN/te_IN.go
+++ b/te_IN/te_IN.go
@@ -248,3 +248,88 @@ func (te *te_IN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'te_IN'
+// 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 (te *te_IN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := te.currencies[currency]
+ l := len(s) + len(te.decimal) + len(te.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, te.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ b = append(b, te.group[0])
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(te.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, te.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, te.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, te.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/teo/teo.go b/teo/teo.go
index 3137c19a..2ada0601 100644
--- a/teo/teo.go
+++ b/teo/teo.go
@@ -167,3 +167,85 @@ func (teo *teo) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'teo'
+// 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 (teo *teo) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := teo.currencies[currency]
+ l := len(s) + len(teo.decimal) + len(teo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(teo.decimal) - 1; j >= 0; j-- {
+ b = append(b, teo.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(teo.group) - 1; j >= 0; j-- {
+ b = append(b, teo.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(teo.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, teo.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, teo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, teo.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/teo_KE/teo_KE.go b/teo_KE/teo_KE.go
index 6b6b9581..b1cc5f44 100644
--- a/teo_KE/teo_KE.go
+++ b/teo_KE/teo_KE.go
@@ -167,3 +167,85 @@ func (teo *teo_KE) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'teo_KE'
+// 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 (teo *teo_KE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := teo.currencies[currency]
+ l := len(s) + len(teo.decimal) + len(teo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(teo.decimal) - 1; j >= 0; j-- {
+ b = append(b, teo.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(teo.group) - 1; j >= 0; j-- {
+ b = append(b, teo.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(teo.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, teo.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, teo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, teo.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/teo_UG/teo_UG.go b/teo_UG/teo_UG.go
index 5c344470..e28a92b6 100644
--- a/teo_UG/teo_UG.go
+++ b/teo_UG/teo_UG.go
@@ -167,3 +167,85 @@ func (teo *teo_UG) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'teo_UG'
+// 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 (teo *teo_UG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := teo.currencies[currency]
+ l := len(s) + len(teo.decimal) + len(teo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(teo.decimal) - 1; j >= 0; j-- {
+ b = append(b, teo.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(teo.group) - 1; j >= 0; j-- {
+ b = append(b, teo.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(teo.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, teo.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, teo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, teo.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/th/th.go b/th/th.go
index 3aca9d00..21efd57f 100644
--- a/th/th.go
+++ b/th/th.go
@@ -212,3 +212,79 @@ func (th *th) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'th'
+// 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 (th *th) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := th.currencies[currency]
+ l := len(s) + len(th.decimal) + len(th.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, th.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, th.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(th.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, th.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, th.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, th.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/th_TH/th_TH.go b/th_TH/th_TH.go
index 61e47c49..eca11ad7 100644
--- a/th_TH/th_TH.go
+++ b/th_TH/th_TH.go
@@ -212,3 +212,79 @@ func (th *th_TH) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'th_TH'
+// 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 (th *th_TH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := th.currencies[currency]
+ l := len(s) + len(th.decimal) + len(th.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, th.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, th.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(th.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, th.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, th.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, th.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ti/ti.go b/ti/ti.go
index ca86185d..4aa1c50e 100644
--- a/ti/ti.go
+++ b/ti/ti.go
@@ -163,3 +163,79 @@ func (ti *ti) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ti'
+// 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 (ti *ti) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ti.currencies[currency]
+ l := len(s) + len(ti.decimal) + len(ti.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ti.decimal) - 1; j >= 0; j-- {
+ b = append(b, ti.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ti.group) - 1; j >= 0; j-- {
+ b = append(b, ti.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ti.minus) - 1; j >= 0; j-- {
+ b = append(b, ti.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ti.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ti_ER/ti_ER.go b/ti_ER/ti_ER.go
index 677ee43a..ef9c9de3 100644
--- a/ti_ER/ti_ER.go
+++ b/ti_ER/ti_ER.go
@@ -163,3 +163,79 @@ func (ti *ti_ER) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ti_ER'
+// 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 (ti *ti_ER) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ti.currencies[currency]
+ l := len(s) + len(ti.decimal) + len(ti.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ti.decimal) - 1; j >= 0; j-- {
+ b = append(b, ti.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ti.group) - 1; j >= 0; j-- {
+ b = append(b, ti.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ti.minus) - 1; j >= 0; j-- {
+ b = append(b, ti.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ti.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ti_ET/ti_ET.go b/ti_ET/ti_ET.go
index 2387fb59..51d3ca7f 100644
--- a/ti_ET/ti_ET.go
+++ b/ti_ET/ti_ET.go
@@ -163,3 +163,79 @@ func (ti *ti_ET) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ti_ET'
+// 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 (ti *ti_ET) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ti.currencies[currency]
+ l := len(s) + len(ti.decimal) + len(ti.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(ti.decimal) - 1; j >= 0; j-- {
+ b = append(b, ti.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(ti.group) - 1; j >= 0; j-- {
+ b = append(b, ti.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ti.minus) - 1; j >= 0; j-- {
+ b = append(b, ti.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ti.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/tk/tk.go b/tk/tk.go
index 896bc032..0bce8a5c 100644
--- a/tk/tk.go
+++ b/tk/tk.go
@@ -229,3 +229,78 @@ func (tk *tk) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'tk'
+// 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 (tk *tk) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := tk.currencies[currency]
+ l := len(s) + len(tk.decimal) + len(tk.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, tk.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(tk.group) - 1; j >= 0; j-- {
+ b = append(b, tk.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, tk.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, tk.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, tk.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, tk.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/tk_TM/tk_TM.go b/tk_TM/tk_TM.go
index cc6170fa..44bccc77 100644
--- a/tk_TM/tk_TM.go
+++ b/tk_TM/tk_TM.go
@@ -229,3 +229,78 @@ func (tk *tk_TM) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'tk_TM'
+// 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 (tk *tk_TM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := tk.currencies[currency]
+ l := len(s) + len(tk.decimal) + len(tk.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, tk.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(tk.group) - 1; j >= 0; j-- {
+ b = append(b, tk.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, tk.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, tk.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, tk.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, tk.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/to/to.go b/to/to.go
index 5b04eca7..7d0aa728 100644
--- a/to/to.go
+++ b/to/to.go
@@ -216,3 +216,79 @@ func (to *to) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'to'
+// 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 (to *to) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := to.currencies[currency]
+ l := len(s) + len(to.decimal) + len(to.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, to.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, to.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(to.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, to.currencyNegativePrefix[j])
+ }
+
+ b = append(b, to.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(to.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, to.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, to.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/to_TO/to_TO.go b/to_TO/to_TO.go
index 92c8d066..4d406739 100644
--- a/to_TO/to_TO.go
+++ b/to_TO/to_TO.go
@@ -216,3 +216,79 @@ func (to *to_TO) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'to_TO'
+// 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 (to *to_TO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := to.currencies[currency]
+ l := len(s) + len(to.decimal) + len(to.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, to.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, to.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(to.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, to.currencyNegativePrefix[j])
+ }
+
+ b = append(b, to.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(to.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, to.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, to.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/tr/tr.go b/tr/tr.go
index ac51028a..6eba1719 100644
--- a/tr/tr.go
+++ b/tr/tr.go
@@ -244,3 +244,77 @@ func (tr *tr) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'tr'
+// 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 (tr *tr) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := tr.currencies[currency]
+ l := len(s) + len(tr.decimal) + len(tr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, tr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, tr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(tr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, tr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, tr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, tr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, tr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/tr_CY/tr_CY.go b/tr_CY/tr_CY.go
index 1a98575f..8424ec22 100644
--- a/tr_CY/tr_CY.go
+++ b/tr_CY/tr_CY.go
@@ -244,3 +244,77 @@ func (tr *tr_CY) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'tr_CY'
+// 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 (tr *tr_CY) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := tr.currencies[currency]
+ l := len(s) + len(tr.decimal) + len(tr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, tr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, tr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(tr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, tr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, tr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, tr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, tr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/tr_TR/tr_TR.go b/tr_TR/tr_TR.go
index b3b185ff..1480db7d 100644
--- a/tr_TR/tr_TR.go
+++ b/tr_TR/tr_TR.go
@@ -244,3 +244,77 @@ func (tr *tr_TR) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'tr_TR'
+// 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 (tr *tr_TR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := tr.currencies[currency]
+ l := len(s) + len(tr.decimal) + len(tr.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, tr.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, tr.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(tr.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, tr.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, tr.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, tr.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, tr.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/twq/twq.go b/twq/twq.go
index 7287577a..6547ebd3 100644
--- a/twq/twq.go
+++ b/twq/twq.go
@@ -218,3 +218,76 @@ func (twq *twq) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'twq'
+// 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 (twq *twq) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := twq.currencies[currency]
+ l := len(s) + len(twq.decimal) + len(twq.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, twq.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(twq.group) - 1; j >= 0; j-- {
+ b = append(b, twq.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(twq.minus) - 1; j >= 0; j-- {
+ b = append(b, twq.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, twq.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/twq_NE/twq_NE.go b/twq_NE/twq_NE.go
index 3cda0431..4192352f 100644
--- a/twq_NE/twq_NE.go
+++ b/twq_NE/twq_NE.go
@@ -218,3 +218,76 @@ func (twq *twq_NE) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'twq_NE'
+// 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 (twq *twq_NE) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := twq.currencies[currency]
+ l := len(s) + len(twq.decimal) + len(twq.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, twq.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(twq.group) - 1; j >= 0; j-- {
+ b = append(b, twq.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(twq.minus) - 1; j >= 0; j-- {
+ b = append(b, twq.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, twq.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/tzm/tzm.go b/tzm/tzm.go
index f5fdeea9..77438e57 100644
--- a/tzm/tzm.go
+++ b/tzm/tzm.go
@@ -164,3 +164,80 @@ func (tzm *tzm) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'tzm'
+// 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 (tzm *tzm) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := tzm.currencies[currency]
+ l := len(s) + len(tzm.decimal) + len(tzm.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, tzm.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(tzm.group) - 1; j >= 0; j-- {
+ b = append(b, tzm.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(tzm.minus) - 1; j >= 0; j-- {
+ b = append(b, tzm.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, tzm.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, tzm.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, tzm.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/tzm_MA/tzm_MA.go b/tzm_MA/tzm_MA.go
index cd1a1a91..bc238802 100644
--- a/tzm_MA/tzm_MA.go
+++ b/tzm_MA/tzm_MA.go
@@ -164,3 +164,80 @@ func (tzm *tzm_MA) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'tzm_MA'
+// 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 (tzm *tzm_MA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := tzm.currencies[currency]
+ l := len(s) + len(tzm.decimal) + len(tzm.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, tzm.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(tzm.group) - 1; j >= 0; j-- {
+ b = append(b, tzm.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(tzm.minus) - 1; j >= 0; j-- {
+ b = append(b, tzm.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, tzm.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, tzm.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, tzm.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ug/ug.go b/ug/ug.go
index c45c92b7..352eff7c 100644
--- a/ug/ug.go
+++ b/ug/ug.go
@@ -230,3 +230,79 @@ func (ug *ug) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ug'
+// 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 (ug *ug) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ug.currencies[currency]
+ l := len(s) + len(ug.decimal) + len(ug.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ug.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ug.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ug.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ug.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ug.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ug.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/ug_CN/ug_CN.go b/ug_CN/ug_CN.go
index eaa35b83..d4b31852 100644
--- a/ug_CN/ug_CN.go
+++ b/ug_CN/ug_CN.go
@@ -230,3 +230,79 @@ func (ug *ug_CN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ug_CN'
+// 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 (ug *ug_CN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ug.currencies[currency]
+ l := len(s) + len(ug.decimal) + len(ug.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ug.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, ug.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ug.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ug.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ug.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, ug.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/uk/uk.go b/uk/uk.go
index 038e894d..1e70b775 100644
--- a/uk/uk.go
+++ b/uk/uk.go
@@ -82,8 +82,8 @@ func (uk *uk) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
func (uk *uk) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
n := math.Abs(num)
- nMod10 := math.Mod(n, 10)
nMod100 := math.Mod(n, 100)
+ nMod10 := math.Mod(n, 10)
if nMod10 == 3 && nMod100 != 13 {
return locales.PluralRuleFew
@@ -276,3 +276,78 @@ func (uk *uk) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'uk'
+// 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 (uk *uk) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := uk.currencies[currency]
+ l := len(s) + len(uk.decimal) + len(uk.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, uk.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(uk.group) - 1; j >= 0; j-- {
+ b = append(b, uk.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(uk.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, uk.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, uk.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, uk.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/uk_UA/uk_UA.go b/uk_UA/uk_UA.go
index a8901ff6..41eba885 100644
--- a/uk_UA/uk_UA.go
+++ b/uk_UA/uk_UA.go
@@ -276,3 +276,78 @@ func (uk *uk_UA) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'uk_UA'
+// 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 (uk *uk_UA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := uk.currencies[currency]
+ l := len(s) + len(uk.decimal) + len(uk.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, uk.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(uk.group) - 1; j >= 0; j-- {
+ b = append(b, uk.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(uk.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, uk.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, uk.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, uk.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/ur/ur.go b/ur/ur.go
index 928bc22f..27fd45e6 100644
--- a/ur/ur.go
+++ b/ur/ur.go
@@ -239,3 +239,90 @@ func (ur *ur) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ur'
+// 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 (ur *ur) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ur.currencies[currency]
+ l := len(s) + len(ur.decimal) + len(ur.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ur.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ b = append(b, ur.group[0])
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ur.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ur.currencyNegativePrefix[j])
+ }
+
+ for j := len(ur.minus) - 1; j >= 0; j-- {
+ b = append(b, ur.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ur.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ur.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ur.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ur_IN/ur_IN.go b/ur_IN/ur_IN.go
index 70d1e117..9203f4b0 100644
--- a/ur_IN/ur_IN.go
+++ b/ur_IN/ur_IN.go
@@ -239,3 +239,90 @@ func (ur *ur_IN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ur_IN'
+// 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 (ur *ur_IN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ur.currencies[currency]
+ l := len(s) + len(ur.decimal) + len(ur.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ur.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ b = append(b, ur.group[0])
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ur.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ur.currencyNegativePrefix[j])
+ }
+
+ for j := len(ur.minus) - 1; j >= 0; j-- {
+ b = append(b, ur.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ur.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ur.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ur.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/ur_PK/ur_PK.go b/ur_PK/ur_PK.go
index ac0b517d..2ed3e129 100644
--- a/ur_PK/ur_PK.go
+++ b/ur_PK/ur_PK.go
@@ -239,3 +239,90 @@ func (ur *ur_PK) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ur_PK'
+// 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 (ur *ur_PK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := ur.currencies[currency]
+ l := len(s) + len(ur.decimal) + len(ur.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ inSecondary := false
+ groupThreshold := 3
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, ur.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+
+ if count == groupThreshold {
+ b = append(b, ur.group[0])
+ count = 1
+
+ if !inSecondary {
+ inSecondary = true
+ groupThreshold = 2
+ }
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ur.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, ur.currencyNegativePrefix[j])
+ }
+
+ for j := len(ur.minus) - 1; j >= 0; j-- {
+ b = append(b, ur.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(ur.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, ur.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, ur.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/uz/uz.go b/uz/uz.go
index 36a24074..fe9a0c41 100644
--- a/uz/uz.go
+++ b/uz/uz.go
@@ -249,3 +249,85 @@ func (uz *uz) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'uz'
+// 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 (uz *uz) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := uz.currencies[currency]
+ l := len(s) + len(uz.decimal) + len(uz.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(uz.decimal) - 1; j >= 0; j-- {
+ b = append(b, uz.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(uz.group) - 1; j >= 0; j-- {
+ b = append(b, uz.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(uz.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, uz.currencyNegativePrefix[j])
+ }
+
+ b = append(b, uz.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(uz.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, uz.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, uz.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/uz_Arab/uz_Arab.go b/uz_Arab/uz_Arab.go
index abda7e18..6ad80331 100644
--- a/uz_Arab/uz_Arab.go
+++ b/uz_Arab/uz_Arab.go
@@ -245,3 +245,81 @@ func (uz *uz_Arab) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'uz_Arab'
+// 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 (uz *uz_Arab) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := uz.currencies[currency]
+ l := len(s) + len(uz.decimal) + len(uz.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(uz.decimal) - 1; j >= 0; j-- {
+ b = append(b, uz.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(uz.group) - 1; j >= 0; j-- {
+ b = append(b, uz.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, uz.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, uz.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, uz.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, uz.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/uz_Arab_AF/uz_Arab_AF.go b/uz_Arab_AF/uz_Arab_AF.go
index d5cf1f38..a0ad10e4 100644
--- a/uz_Arab_AF/uz_Arab_AF.go
+++ b/uz_Arab_AF/uz_Arab_AF.go
@@ -249,3 +249,85 @@ func (uz *uz_Arab_AF) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'uz_Arab_AF'
+// 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 (uz *uz_Arab_AF) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := uz.currencies[currency]
+ l := len(s) + len(uz.decimal) + len(uz.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(uz.decimal) - 1; j >= 0; j-- {
+ b = append(b, uz.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(uz.group) - 1; j >= 0; j-- {
+ b = append(b, uz.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(uz.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, uz.currencyNegativePrefix[j])
+ }
+
+ b = append(b, uz.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(uz.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, uz.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, uz.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/uz_Cyrl/uz_Cyrl.go b/uz_Cyrl/uz_Cyrl.go
index 042845c5..7556b9ed 100644
--- a/uz_Cyrl/uz_Cyrl.go
+++ b/uz_Cyrl/uz_Cyrl.go
@@ -249,3 +249,85 @@ func (uz *uz_Cyrl) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'uz_Cyrl'
+// 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 (uz *uz_Cyrl) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := uz.currencies[currency]
+ l := len(s) + len(uz.decimal) + len(uz.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(uz.decimal) - 1; j >= 0; j-- {
+ b = append(b, uz.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(uz.group) - 1; j >= 0; j-- {
+ b = append(b, uz.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(uz.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, uz.currencyNegativePrefix[j])
+ }
+
+ b = append(b, uz.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(uz.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, uz.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, uz.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/uz_Cyrl_UZ/uz_Cyrl_UZ.go b/uz_Cyrl_UZ/uz_Cyrl_UZ.go
index 81fbfa78..7522a9a4 100644
--- a/uz_Cyrl_UZ/uz_Cyrl_UZ.go
+++ b/uz_Cyrl_UZ/uz_Cyrl_UZ.go
@@ -249,3 +249,85 @@ func (uz *uz_Cyrl_UZ) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'uz_Cyrl_UZ'
+// 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 (uz *uz_Cyrl_UZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := uz.currencies[currency]
+ l := len(s) + len(uz.decimal) + len(uz.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(uz.decimal) - 1; j >= 0; j-- {
+ b = append(b, uz.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(uz.group) - 1; j >= 0; j-- {
+ b = append(b, uz.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(uz.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, uz.currencyNegativePrefix[j])
+ }
+
+ b = append(b, uz.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(uz.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, uz.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, uz.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/uz_Latn/uz_Latn.go b/uz_Latn/uz_Latn.go
index 8f922bd4..dfa7e37e 100644
--- a/uz_Latn/uz_Latn.go
+++ b/uz_Latn/uz_Latn.go
@@ -249,3 +249,85 @@ func (uz *uz_Latn) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'uz_Latn'
+// 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 (uz *uz_Latn) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := uz.currencies[currency]
+ l := len(s) + len(uz.decimal) + len(uz.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(uz.decimal) - 1; j >= 0; j-- {
+ b = append(b, uz.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(uz.group) - 1; j >= 0; j-- {
+ b = append(b, uz.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(uz.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, uz.currencyNegativePrefix[j])
+ }
+
+ b = append(b, uz.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(uz.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, uz.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, uz.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/uz_Latn_UZ/uz_Latn_UZ.go b/uz_Latn_UZ/uz_Latn_UZ.go
index 93a6af8e..9dd8e093 100644
--- a/uz_Latn_UZ/uz_Latn_UZ.go
+++ b/uz_Latn_UZ/uz_Latn_UZ.go
@@ -249,3 +249,85 @@ func (uz *uz_Latn_UZ) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'uz_Latn_UZ'
+// 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 (uz *uz_Latn_UZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := uz.currencies[currency]
+ l := len(s) + len(uz.decimal) + len(uz.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(uz.decimal) - 1; j >= 0; j-- {
+ b = append(b, uz.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(uz.group) - 1; j >= 0; j-- {
+ b = append(b, uz.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(uz.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, uz.currencyNegativePrefix[j])
+ }
+
+ b = append(b, uz.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(uz.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, uz.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, uz.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/vai/vai.go b/vai/vai.go
index 2e7c0076..ea399f17 100644
--- a/vai/vai.go
+++ b/vai/vai.go
@@ -191,3 +191,79 @@ func (vai *vai) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'vai'
+// 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 (vai *vai) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := vai.currencies[currency]
+ l := len(s) + len(vai.decimal) + len(vai.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, vai.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, vai.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(vai.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, vai.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, vai.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, vai.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/vai_Latn/vai_Latn.go b/vai_Latn/vai_Latn.go
index 90a14c54..f7b47e4a 100644
--- a/vai_Latn/vai_Latn.go
+++ b/vai_Latn/vai_Latn.go
@@ -191,3 +191,79 @@ func (vai *vai_Latn) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'vai_Latn'
+// 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 (vai *vai_Latn) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := vai.currencies[currency]
+ l := len(s) + len(vai.decimal) + len(vai.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, vai.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, vai.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(vai.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, vai.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, vai.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, vai.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/vai_Latn_LR/vai_Latn_LR.go b/vai_Latn_LR/vai_Latn_LR.go
index 35a87fc1..8db098ab 100644
--- a/vai_Latn_LR/vai_Latn_LR.go
+++ b/vai_Latn_LR/vai_Latn_LR.go
@@ -191,3 +191,79 @@ func (vai *vai_Latn_LR) FmtCurrency(num float64, v uint64, currency currency.Typ
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'vai_Latn_LR'
+// 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 (vai *vai_Latn_LR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := vai.currencies[currency]
+ l := len(s) + len(vai.decimal) + len(vai.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, vai.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, vai.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(vai.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, vai.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, vai.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, vai.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/vai_Vaii/vai_Vaii.go b/vai_Vaii/vai_Vaii.go
index 1b037c33..faa9b882 100644
--- a/vai_Vaii/vai_Vaii.go
+++ b/vai_Vaii/vai_Vaii.go
@@ -191,3 +191,79 @@ func (vai *vai_Vaii) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'vai_Vaii'
+// 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 (vai *vai_Vaii) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := vai.currencies[currency]
+ l := len(s) + len(vai.decimal) + len(vai.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, vai.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, vai.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(vai.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, vai.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, vai.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, vai.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/vai_Vaii_LR/vai_Vaii_LR.go b/vai_Vaii_LR/vai_Vaii_LR.go
index 6c7b5e97..18eeb447 100644
--- a/vai_Vaii_LR/vai_Vaii_LR.go
+++ b/vai_Vaii_LR/vai_Vaii_LR.go
@@ -191,3 +191,79 @@ func (vai *vai_Vaii_LR) FmtCurrency(num float64, v uint64, currency currency.Typ
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'vai_Vaii_LR'
+// 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 (vai *vai_Vaii_LR) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := vai.currencies[currency]
+ l := len(s) + len(vai.decimal) + len(vai.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, vai.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, vai.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(vai.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, vai.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, vai.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, vai.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/vi/vi.go b/vi/vi.go
index 0fe48dcc..8aba0f2b 100644
--- a/vi/vi.go
+++ b/vi/vi.go
@@ -219,3 +219,75 @@ func (vi *vi) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'vi'
+// 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 (vi *vi) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := vi.currencies[currency]
+ l := len(s) + len(vi.decimal) + len(vi.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, vi.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, vi.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, vi.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, vi.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, vi.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, vi.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/vi_VN/vi_VN.go b/vi_VN/vi_VN.go
index 23d11da3..ad5f2151 100644
--- a/vi_VN/vi_VN.go
+++ b/vi_VN/vi_VN.go
@@ -219,3 +219,75 @@ func (vi *vi_VN) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'vi_VN'
+// 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 (vi *vi_VN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := vi.currencies[currency]
+ l := len(s) + len(vi.decimal) + len(vi.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, vi.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, vi.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ b = append(b, vi.minus[0])
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, vi.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, vi.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, vi.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/vo/vo.go b/vo/vo.go
index f69d2000..6c5a592a 100644
--- a/vo/vo.go
+++ b/vo/vo.go
@@ -103,5 +103,15 @@ func (vo *vo) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
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'
+// 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) 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...)
}
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...)
}
diff --git a/vun/vun.go b/vun/vun.go
index b745ad85..f319fd2d 100644
--- a/vun/vun.go
+++ b/vun/vun.go
@@ -163,3 +163,79 @@ func (vun *vun) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'vun'
+// 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 (vun *vun) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := vun.currencies[currency]
+ l := len(s) + len(vun.decimal) + len(vun.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(vun.decimal) - 1; j >= 0; j-- {
+ b = append(b, vun.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(vun.group) - 1; j >= 0; j-- {
+ b = append(b, vun.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(vun.minus) - 1; j >= 0; j-- {
+ b = append(b, vun.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, vun.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/vun_TZ/vun_TZ.go b/vun_TZ/vun_TZ.go
index b041dfdb..b99b3fe5 100644
--- a/vun_TZ/vun_TZ.go
+++ b/vun_TZ/vun_TZ.go
@@ -163,3 +163,79 @@ func (vun *vun_TZ) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'vun_TZ'
+// 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 (vun *vun_TZ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := vun.currencies[currency]
+ l := len(s) + len(vun.decimal) + len(vun.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(vun.decimal) - 1; j >= 0; j-- {
+ b = append(b, vun.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(vun.group) - 1; j >= 0; j-- {
+ b = append(b, vun.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(vun.minus) - 1; j >= 0; j-- {
+ b = append(b, vun.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, vun.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ return b
+}
diff --git a/wae/wae.go b/wae/wae.go
index b5b20391..5e639360 100644
--- a/wae/wae.go
+++ b/wae/wae.go
@@ -148,3 +148,68 @@ func (wae *wae) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'wae'
+// 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 (wae *wae) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := wae.currencies[currency]
+ l := len(s) + len(wae.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, wae.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(wae.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, wae.currencyNegativePrefix[j])
+ }
+
+ for j := len(wae.minus) - 1; j >= 0; j-- {
+ b = append(b, wae.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(wae.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, wae.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, wae.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, wae.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/wae_CH/wae_CH.go b/wae_CH/wae_CH.go
index 2488f9cb..3e75b932 100644
--- a/wae_CH/wae_CH.go
+++ b/wae_CH/wae_CH.go
@@ -148,3 +148,68 @@ func (wae *wae_CH) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'wae_CH'
+// 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 (wae *wae_CH) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := wae.currencies[currency]
+ l := len(s) + len(wae.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, wae.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(wae.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, wae.currencyNegativePrefix[j])
+ }
+
+ for j := len(wae.minus) - 1; j >= 0; j-- {
+ b = append(b, wae.minus[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(wae.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, wae.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, wae.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, wae.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/xog/xog.go b/xog/xog.go
index 9414bcab..ffa4955f 100644
--- a/xog/xog.go
+++ b/xog/xog.go
@@ -167,3 +167,83 @@ func (xog *xog) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'xog'
+// 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 (xog *xog) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := xog.currencies[currency]
+ l := len(s) + len(xog.decimal) + len(xog.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(xog.decimal) - 1; j >= 0; j-- {
+ b = append(b, xog.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(xog.group) - 1; j >= 0; j-- {
+ b = append(b, xog.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(xog.minus) - 1; j >= 0; j-- {
+ b = append(b, xog.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, xog.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, xog.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, xog.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/xog_UG/xog_UG.go b/xog_UG/xog_UG.go
index 0c4b5953..9d72c8d4 100644
--- a/xog_UG/xog_UG.go
+++ b/xog_UG/xog_UG.go
@@ -167,3 +167,83 @@ func (xog *xog_UG) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'xog_UG'
+// 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 (xog *xog_UG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := xog.currencies[currency]
+ l := len(s) + len(xog.decimal) + len(xog.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(xog.decimal) - 1; j >= 0; j-- {
+ b = append(b, xog.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(xog.group) - 1; j >= 0; j-- {
+ b = append(b, xog.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(xog.minus) - 1; j >= 0; j-- {
+ b = append(b, xog.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, xog.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, xog.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, xog.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/yav/yav.go b/yav/yav.go
index 0b3d00dc..4f65a27b 100644
--- a/yav/yav.go
+++ b/yav/yav.go
@@ -226,3 +226,80 @@ func (yav *yav) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'yav'
+// 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 (yav *yav) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := yav.currencies[currency]
+ l := len(s) + len(yav.decimal) + len(yav.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, yav.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(yav.group) - 1; j >= 0; j-- {
+ b = append(b, yav.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(yav.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, yav.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, yav.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, yav.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, yav.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/yav_CM/yav_CM.go b/yav_CM/yav_CM.go
index 3c9754cc..0a26cb44 100644
--- a/yav_CM/yav_CM.go
+++ b/yav_CM/yav_CM.go
@@ -226,3 +226,80 @@ func (yav *yav_CM) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'yav_CM'
+// 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 (yav *yav_CM) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := yav.currencies[currency]
+ l := len(s) + len(yav.decimal) + len(yav.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, yav.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(yav.group) - 1; j >= 0; j-- {
+ b = append(b, yav.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(yav.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, yav.currencyNegativePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, yav.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, yav.currencyNegativeSuffix...)
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, yav.currencyPositiveSuffix...)
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/yi/yi.go b/yi/yi.go
index 36a937fb..e201409f 100644
--- a/yi/yi.go
+++ b/yi/yi.go
@@ -147,3 +147,66 @@ func (yi *yi) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'yi'
+// 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 (yi *yi) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := yi.currencies[currency]
+ l := len(s) + len(yi.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, yi.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(yi.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, yi.currencyNegativePrefix[j])
+ }
+
+ b = append(b, yi.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(yi.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, yi.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, yi.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, yi.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/yi_001/yi_001.go b/yi_001/yi_001.go
index df83e889..e54624a1 100644
--- a/yi_001/yi_001.go
+++ b/yi_001/yi_001.go
@@ -147,3 +147,66 @@ func (yi *yi_001) FmtCurrency(num float64, v uint64, currency currency.Type) []b
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'yi_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 (yi *yi_001) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := yi.currencies[currency]
+ l := len(s) + len(yi.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, yi.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(yi.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, yi.currencyNegativePrefix[j])
+ }
+
+ b = append(b, yi.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(yi.currencyPositivePrefix) - 1; j >= 0; j-- {
+ b = append(b, yi.currencyPositivePrefix[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, yi.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, yi.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/yo/yo.go b/yo/yo.go
index 9994a1d6..699d594d 100644
--- a/yo/yo.go
+++ b/yo/yo.go
@@ -160,3 +160,85 @@ func (yo *yo) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'yo'
+// 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 (yo *yo) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := yo.currencies[currency]
+ l := len(s) + len(yo.decimal) + len(yo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(yo.decimal) - 1; j >= 0; j-- {
+ b = append(b, yo.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(yo.group) - 1; j >= 0; j-- {
+ b = append(b, yo.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(yo.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, yo.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, yo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, yo.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/yo_BJ/yo_BJ.go b/yo_BJ/yo_BJ.go
index 9acdf92a..28a4d417 100644
--- a/yo_BJ/yo_BJ.go
+++ b/yo_BJ/yo_BJ.go
@@ -160,3 +160,85 @@ func (yo *yo_BJ) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'yo_BJ'
+// 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 (yo *yo_BJ) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := yo.currencies[currency]
+ l := len(s) + len(yo.decimal) + len(yo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(yo.decimal) - 1; j >= 0; j-- {
+ b = append(b, yo.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(yo.group) - 1; j >= 0; j-- {
+ b = append(b, yo.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(yo.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, yo.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, yo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, yo.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/yo_NG/yo_NG.go b/yo_NG/yo_NG.go
index 78cf5784..7e41de82 100644
--- a/yo_NG/yo_NG.go
+++ b/yo_NG/yo_NG.go
@@ -160,3 +160,85 @@ func (yo *yo_NG) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'yo_NG'
+// 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 (yo *yo_NG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := yo.currencies[currency]
+ l := len(s) + len(yo.decimal) + len(yo.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ for j := len(yo.decimal) - 1; j >= 0; j-- {
+ b = append(b, yo.decimal[j])
+ }
+
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(yo.group) - 1; j >= 0; j-- {
+ b = append(b, yo.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(yo.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, yo.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, yo.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, yo.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/yue/yue.go b/yue/yue.go
index cacb4ec3..2b388b60 100644
--- a/yue/yue.go
+++ b/yue/yue.go
@@ -212,3 +212,79 @@ func (yue *yue) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'yue'
+// 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 (yue *yue) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := yue.currencies[currency]
+ l := len(s) + len(yue.decimal) + len(yue.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, yue.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, yue.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(yue.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, yue.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, yue.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, yue.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/yue_HK/yue_HK.go b/yue_HK/yue_HK.go
index 7fafbada..2a65f980 100644
--- a/yue_HK/yue_HK.go
+++ b/yue_HK/yue_HK.go
@@ -212,3 +212,79 @@ func (yue *yue_HK) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'yue_HK'
+// 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 (yue *yue_HK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := yue.currencies[currency]
+ l := len(s) + len(yue.decimal) + len(yue.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, yue.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, yue.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(yue.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, yue.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, yue.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, yue.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/zgh/zgh.go b/zgh/zgh.go
index ae13d47c..2053faba 100644
--- a/zgh/zgh.go
+++ b/zgh/zgh.go
@@ -182,3 +182,76 @@ func (zgh *zgh) FmtCurrency(num float64, v uint64, currency currency.Type) []byt
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'zgh'
+// 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 (zgh *zgh) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := zgh.currencies[currency]
+ l := len(s) + len(zgh.decimal) + len(zgh.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, zgh.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(zgh.group) - 1; j >= 0; j-- {
+ b = append(b, zgh.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(zgh.minus) - 1; j >= 0; j-- {
+ b = append(b, zgh.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, zgh.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/zgh_MA/zgh_MA.go b/zgh_MA/zgh_MA.go
index 7069cf41..980e17cf 100644
--- a/zgh_MA/zgh_MA.go
+++ b/zgh_MA/zgh_MA.go
@@ -182,3 +182,76 @@ func (zgh *zgh_MA) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'zgh_MA'
+// 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 (zgh *zgh_MA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := zgh.currencies[currency]
+ l := len(s) + len(zgh.decimal) + len(zgh.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, zgh.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ for j := len(zgh.group) - 1; j >= 0; j-- {
+ b = append(b, zgh.group[j])
+ }
+
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(zgh.minus) - 1; j >= 0; j-- {
+ b = append(b, zgh.minus[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, zgh.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, symbol...)
+
+ } else {
+
+ b = append(b, symbol...)
+
+ }
+
+ return b
+}
diff --git a/zh/zh.go b/zh/zh.go
index dbb1c79d..2e7a513e 100644
--- a/zh/zh.go
+++ b/zh/zh.go
@@ -212,3 +212,79 @@ func (zh *zh) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'zh'
+// 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 (zh *zh) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := zh.currencies[currency]
+ l := len(s) + len(zh.decimal) + len(zh.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, zh.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, zh.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(zh.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, zh.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, zh.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, zh.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/zh_Hans/zh_Hans.go b/zh_Hans/zh_Hans.go
index 89045d01..edb6f981 100644
--- a/zh_Hans/zh_Hans.go
+++ b/zh_Hans/zh_Hans.go
@@ -212,3 +212,79 @@ func (zh *zh_Hans) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'zh_Hans'
+// 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 (zh *zh_Hans) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := zh.currencies[currency]
+ l := len(s) + len(zh.decimal) + len(zh.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, zh.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, zh.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(zh.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, zh.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, zh.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, zh.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/zh_Hans_CN/zh_Hans_CN.go b/zh_Hans_CN/zh_Hans_CN.go
index dfbd96dc..7a9e5c07 100644
--- a/zh_Hans_CN/zh_Hans_CN.go
+++ b/zh_Hans_CN/zh_Hans_CN.go
@@ -212,3 +212,79 @@ func (zh *zh_Hans_CN) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'zh_Hans_CN'
+// 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 (zh *zh_Hans_CN) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := zh.currencies[currency]
+ l := len(s) + len(zh.decimal) + len(zh.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, zh.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, zh.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(zh.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, zh.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, zh.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, zh.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/zh_Hans_HK/zh_Hans_HK.go b/zh_Hans_HK/zh_Hans_HK.go
index ed1d4585..4f148bcd 100644
--- a/zh_Hans_HK/zh_Hans_HK.go
+++ b/zh_Hans_HK/zh_Hans_HK.go
@@ -212,3 +212,79 @@ func (zh *zh_Hans_HK) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'zh_Hans_HK'
+// 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 (zh *zh_Hans_HK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := zh.currencies[currency]
+ l := len(s) + len(zh.decimal) + len(zh.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, zh.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, zh.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(zh.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, zh.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, zh.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, zh.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/zh_Hans_MO/zh_Hans_MO.go b/zh_Hans_MO/zh_Hans_MO.go
index f0b9ddac..dfb61cc2 100644
--- a/zh_Hans_MO/zh_Hans_MO.go
+++ b/zh_Hans_MO/zh_Hans_MO.go
@@ -212,3 +212,79 @@ func (zh *zh_Hans_MO) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'zh_Hans_MO'
+// 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 (zh *zh_Hans_MO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := zh.currencies[currency]
+ l := len(s) + len(zh.decimal) + len(zh.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, zh.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, zh.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(zh.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, zh.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, zh.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, zh.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/zh_Hans_SG/zh_Hans_SG.go b/zh_Hans_SG/zh_Hans_SG.go
index 7b21bc8e..54c76ff1 100644
--- a/zh_Hans_SG/zh_Hans_SG.go
+++ b/zh_Hans_SG/zh_Hans_SG.go
@@ -212,3 +212,79 @@ func (zh *zh_Hans_SG) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'zh_Hans_SG'
+// 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 (zh *zh_Hans_SG) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := zh.currencies[currency]
+ l := len(s) + len(zh.decimal) + len(zh.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, zh.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, zh.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(zh.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, zh.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, zh.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, zh.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/zh_Hant/zh_Hant.go b/zh_Hant/zh_Hant.go
index 50475f82..8189df8e 100644
--- a/zh_Hant/zh_Hant.go
+++ b/zh_Hant/zh_Hant.go
@@ -212,3 +212,79 @@ func (zh *zh_Hant) FmtCurrency(num float64, v uint64, currency currency.Type) []
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'zh_Hant'
+// 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 (zh *zh_Hant) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := zh.currencies[currency]
+ l := len(s) + len(zh.decimal) + len(zh.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, zh.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, zh.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(zh.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, zh.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, zh.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, zh.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/zh_Hant_HK/zh_Hant_HK.go b/zh_Hant_HK/zh_Hant_HK.go
index 6ac9f97c..772a94c4 100644
--- a/zh_Hant_HK/zh_Hant_HK.go
+++ b/zh_Hant_HK/zh_Hant_HK.go
@@ -191,3 +191,58 @@ func (zh *zh_Hant_HK) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'zh_Hant_HK'
+// 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 (zh *zh_Hant_HK) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := zh.currencies[currency]
+ l := len(s) + len(zh.decimal)
+
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, zh.decimal[0])
+ continue
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ b = append(b, zh.minus[0])
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if num < 0 {
+
+ b = append(b, zh.currencyNegativeSuffix...)
+
+ } else {
+
+ b = append(b, zh.currencyPositiveSuffix...)
+
+ }
+
+ return b
+}
diff --git a/zh_Hant_MO/zh_Hant_MO.go b/zh_Hant_MO/zh_Hant_MO.go
index 48b5e2ae..ca06cf9c 100644
--- a/zh_Hant_MO/zh_Hant_MO.go
+++ b/zh_Hant_MO/zh_Hant_MO.go
@@ -212,3 +212,79 @@ func (zh *zh_Hant_MO) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'zh_Hant_MO'
+// 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 (zh *zh_Hant_MO) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := zh.currencies[currency]
+ l := len(s) + len(zh.decimal) + len(zh.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, zh.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, zh.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(zh.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, zh.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, zh.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, zh.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/zh_Hant_TW/zh_Hant_TW.go b/zh_Hant_TW/zh_Hant_TW.go
index 310a22b3..0b011a1f 100644
--- a/zh_Hant_TW/zh_Hant_TW.go
+++ b/zh_Hant_TW/zh_Hant_TW.go
@@ -212,3 +212,79 @@ func (zh *zh_Hant_TW) FmtCurrency(num float64, v uint64, currency currency.Type)
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'zh_Hant_TW'
+// 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 (zh *zh_Hant_TW) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := zh.currencies[currency]
+ l := len(s) + len(zh.decimal) + len(zh.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, zh.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, zh.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(zh.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, zh.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, zh.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, zh.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/zu/zu.go b/zu/zu.go
index 33f9f657..2eee86e2 100644
--- a/zu/zu.go
+++ b/zu/zu.go
@@ -231,3 +231,79 @@ func (zu *zu) FmtCurrency(num float64, v uint64, currency currency.Type) []byte
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'zu'
+// 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 (zu *zu) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := zu.currencies[currency]
+ l := len(s) + len(zu.decimal) + len(zu.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, zu.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, zu.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(zu.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, zu.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, zu.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, zu.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}
diff --git a/zu_ZA/zu_ZA.go b/zu_ZA/zu_ZA.go
index 56fd8c87..876997e0 100644
--- a/zu_ZA/zu_ZA.go
+++ b/zu_ZA/zu_ZA.go
@@ -231,3 +231,79 @@ func (zu *zu_ZA) FmtCurrency(num float64, v uint64, currency currency.Type) []by
return b
}
+
+// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'zu_ZA'
+// 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 (zu *zu_ZA) FmtAccounting(num float64, v uint64, currency currency.Type) []byte {
+
+ s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
+ symbol := zu.currencies[currency]
+ l := len(s) + len(zu.decimal) + len(zu.group)*len(s[:len(s)-int(v)-1])/3
+ count := 0
+ inWhole := v == 0
+ b := make([]byte, 0, l)
+
+ for i := len(s) - 1; i >= 0; i-- {
+
+ if s[i] == '.' {
+ b = append(b, zu.decimal[0])
+ inWhole = true
+
+ continue
+ }
+
+ if inWhole {
+ if count == 3 {
+ b = append(b, zu.group[0])
+ count = 1
+ } else {
+ count++
+ }
+ }
+
+ b = append(b, s[i])
+ }
+
+ if num < 0 {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ for j := len(zu.currencyNegativePrefix) - 1; j >= 0; j-- {
+ b = append(b, zu.currencyNegativePrefix[j])
+ }
+
+ } else {
+
+ for j := len(symbol) - 1; j >= 0; j-- {
+ b = append(b, symbol[j])
+ }
+
+ }
+
+ // reverse
+ for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
+ b[i], b[j] = b[j], b[i]
+ }
+
+ if int(v) < 2 {
+
+ if v == 0 {
+ b = append(b, zu.decimal...)
+ }
+
+ for i := 0; i < 2-int(v); i++ {
+ b = append(b, '0')
+ }
+ }
+
+ if num < 0 {
+
+ b = append(b, zu.currencyNegativeSuffix...)
+
+ }
+
+ return b
+}