Skip to content

Commit

Permalink
fix(lua): #989 依会计凭证书写要求,修正万亿的金额大写格式
Browse files Browse the repository at this point in the history
  • Loading branch information
mirtlecn committed Sep 12, 2024
1 parent 0367c85 commit 59f81a5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lua/number_translator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,12 @@ local function number_translatorFunc(num)

local number2cnCharInt = number2cnChar(numberPart.int, 1)
local number2cnCharDec = decimal_func(numberPart.dec, { [1] = "", [2] = "", [3] = "", [4] = "" }, { [0] = "", "", "", "", "", "", "", "", "", "" })
table.insert(result, { number2cnCharInt .. number2cnCharDec , "〔金额大写〕"})
if string.len(numberPart.int) > 4 and number2cnCharInt:find('^' .. '拾万') then
number2cnCharInt = number2cnCharInt:gsub('^' .. '拾万', '壹拾万')
table.insert(result, { number2cnCharInt .. number2cnCharDec , "〔金额大写〕"})
if string.len(numberPart.int) > 4 and number2cnCharInt:find('^拾[壹贰叁肆伍陆柒捌玖]?') and number2cnCharInt:find('[万亿]') then -- 简易地规避 utf8 匹配问题
local number2cnCharInt_var = number2cnCharInt:gsub('^', '壹拾')
table.insert(result, { number2cnCharInt_var .. number2cnCharDec , "〔金额大写〕"})
-- 会计书写要求 https://github.com/iDvel/rime-ice/issues/989
end
-- table.insert(result, { number2cnCharInt .. number2cnCharDec , "〔金额大写〕"})
return result
end

Expand Down

0 comments on commit 59f81a5

Please sign in to comment.