fix(lua): #989 依会计凭证书写要求,修正万亿的金额大写格式

This commit is contained in:
mirtlecn 2024-09-12 10:09:31 +08:00
parent 0367c85243
commit 59f81a5a18

View File

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