From 59f81a5a18192c48dae6a1193fba4e42aa77d5d6 Mon Sep 17 00:00:00 2001 From: mirtlecn Date: Thu, 12 Sep 2024 10:09:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(lua):=20#989=20=E4=BE=9D=E4=BC=9A=E8=AE=A1?= =?UTF-8?q?=E5=87=AD=E8=AF=81=E4=B9=A6=E5=86=99=E8=A6=81=E6=B1=82=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=B8=87=E4=BA=BF=E7=9A=84=E9=87=91=E9=A2=9D?= =?UTF-8?q?=E5=A4=A7=E5=86=99=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/number_translator.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lua/number_translator.lua b/lua/number_translator.lua index d4aa521bf..26c64b6de 100644 --- a/lua/number_translator.lua +++ b/lua/number_translator.lua @@ -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