diff --git a/lua/number_translator.lua b/lua/number_translator.lua index d4aa521..26c64b6 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