fix calling number starts at '스물'

This commit is contained in:
kimpure 2026-05-21 13:32:17 +00:00
parent 92f9794beb
commit f1f09cc31a
No known key found for this signature in database
2 changed files with 5 additions and 2 deletions

View file

@ -1,7 +1,7 @@
export default class CallingNumberKorean {
// 개, 살 이 붙는 경우 발음법
static SecondDigit = [
"열", "스물", "서른", "마흔", "쉰",
"", "열", "스물", "서른", "마흔", "쉰",
"예순", "일흔", "여든", "아흔",
]
static FirstDigit = [

View file

@ -161,7 +161,10 @@ export function saferKorean(input: string): string {
mod = SIPrefix[mod.toLowerCase() as keyof typeof SIPrefix];
return `${num} ${mod}바이트 `;
})
.replace(/(\d+)[ \t\n]*([개살시])/g, (_, num: string, postfix: string)=>{
.replace(/([\d.]+)[ \t\n]*([개살시])/g, (_, num: string, postfix: string)=>{
if (num.includes(".")) {
return num + postfix;
}
const intNum = parseInt(num)
if (CallingNumberKorean.canConvert(intNum)) {
return CallingNumberKorean.convert(intNum) + postfix;