@mudssky/jsutils
    Preparing search index...

    Function numberToText

    • 将数字转换为文字表示,支持英文、中文数字以及罗马数字

      Parameters

      • value: number

        要转换的数字(仅整数部分会被处理,会对输入进行截断)

      • Optionaloptions: { system?: "roman" | "english" | "chinese"; useAnd?: boolean }

        配置项

        • Optionalsystem?: "roman" | "english" | "chinese"

          转换系统,可选 'english' | 'chinese' | 'roman',默认 'chinese'

        • OptionaluseAnd?: boolean

          英文模式下是否使用 “and”,如 one hundred and one(默认 false)

      Returns string

      转换后的文字

      numberToText(1994, { system: 'roman' }) // -> 'MCMXCIV'
      numberToText(12345, { system: 'english' }) // -> 'twelve thousand three hundred forty-five'
      numberToText(10005) // -> '一万零五'