Constructors
constructor
-
Parameters
-
Optional options: IOptions
Methods
decode
- decode(zhNum: string, options?: IOptions): number
-
Parameters
-
zhNum: string
-
Optional options: IOptions
Returns number
encode
- encode(num: string | number, options?: IOptions): string
-
Parameters
-
num: string | number
-
Optional options: IOptions
Returns string
toMoney
- toMoney(num: string | number, options?: IOptions): string
-
Parameters
-
num: string | number
-
Optional options: IOptions
Returns string
阿拉伯数字和中文数字互转
const arabicChinese = new ArabicChinese(); // 数字转中文 arabicChinese.encode('1'); // >> '一' // 中文转数字 arabicChinese.decode('一'); // >> 1 // 数字转金额 arabicChinese.decode('1'); // >> 人民币一元整