用法
评论
建议
取 消
确 定
(defun string:number2chinese (num / charofcash i n tempa tempstr) "将数字转化为汉语大写.,仅支持到万亿,只支持整数" "String" "(string:number2chinese 3587823416)" (defun _n2big (str) (setq str (string:subst-all "壹" "1" str)) (setq str (string:subst-all "贰" "2" str)) (setq str (string:subst-all "叁" "3" str)) (setq str (string:subst-all "肆" "4" str)) (setq str (string:subst-all "伍" "5" str)) (setq str (string:subst-all "陆" "6" str)) (setq str (string:subst-all "柒" "7" str)) (setq str (string:subst-all "捌" "8" str)) (setq str (string:subst-all "玖" "9" str))) (setq num (rtos num 2 0)) (setq i -1 charofcash "") (setq n (strlen num)) (repeat n (setq i (1+ i)) (setq tempstr (substr num (- n i) 1)) (cond ((= i 0) (if (= "零" tempstr) (setq tempstr ""))) ((= i 1) (if (/= "零" tempstr) (setq tempstr (strcat tempstr "拾")))) ((= i 2) (if (/= "零" tempstr) (setq tempstr (strcat tempstr "百")))) ((= i 3) (if (/= "零" tempstr) (setq tempstr (strcat tempstr "千")))) ((= i 4) (if (= "零" tempstr) (setq tempstr "万") (setq tempstr (strcat tempstr "万")))) ((= i 5) (if (/= "零" tempstr) (setq tempstr (strcat tempstr "十")))) ((= i 6) (if (/= "零" tempstr) (setq tempstr (strcat tempstr "百")))) ((= i 7) (if (/= "零" tempstr) (setq tempstr (strcat tempstr "千")))) ((= i 8) (if (= "零" tempstr) (setq tempstr "亿") (setq tempstr (strcat tempstr "亿")))) ((= i 9) (if (/= "零" tempstr) (setq tempstr (strcat tempstr "十")))) ((= i 10) (if (/= "零" tempstr) (setq tempstr (strcat tempstr "百")))) ((= i 11) (if (/= "零" tempstr) (setq tempstr (strcat tempstr "千")))) ((= i 12) (if (/= "零" tempstr) (setq tempstr (strcat tempstr "万"))))) (setq tempa (substr charofcash 1 2)) (setq charofcash (if (= tempstr "零") (cond ((= tempa "零") charofcash) ((= tempa "") charofcash) ((= tempa "万") charofcash) ((= tempa "亿") charofcash) (t (strcat tempstr charofcash))) (strcat tempstr charofcash)))) (setq temp (substr charofcash 1 4)) (if (= "壹拾" temp) (substr charofcash 3) charofcash) (_n2big charofcash))
函数库使用说明
应用包
技术支持
统计信息
函数库规模: 733 个
函数库类别: 51 种
上传记录
刷新