如何把阿拉伯数字变成中文数字?谢谢各位大侠

justlove 2002-01-25 07:15:22
...全文
164 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
justlove 2002-01-25
  • 打赏
  • 举报
回复
我不能给分了,我没分了:(
liulee 2002-01-25
  • 打赏
  • 举报
回复

//------------------------------------------
//gf_cm_upper_number(decimal ar_amount) return string
// 参数ar_amount,类型 decimal
// 返回值类型 string
//
//-------------------------------------------
string ls_input
integer li_strlen, li_cursor, li_count
string ls_result, ls_digit
integer li_digit

//String constant
string ls_const_CC_number[] = &
{"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"}
string ls_const_CC_Unit[] = &
{"", "拾", "佰", "仟","万","拾","佰","仟","亿","拾","佰","仟"}
string ls_yuan = "圆", ls_jiao = "角", ls_fen = "分", ls_negtive = "负"

//Convert the input real value to string
ls_input = string(abs(ar_amount), "0.00")
li_strlen = len(ls_input)

//Generate Integer part
ls_result = ls_yuan
li_count = 0
FOR li_cursor = li_strlen - 3 TO 1 STEP -1
li_count = li_count + 1
ls_digit = mid(ls_input, li_cursor, 1)

//Get the index of the table number
li_digit = Integer(ls_digit)
ls_result = ls_const_CC_number[li_digit + 1] + &
ls_const_CC_Unit[li_count] + ls_result
NEXT

//Generate fragment part
ls_digit = mid(ls_input, li_strlen - 1, 1)
li_digit = Integer(ls_digit)
ls_result = ls_result + ls_const_CC_number[li_digit + 1] &
+ ls_jiao

ls_digit = mid(ls_input, li_strlen , 1)
li_digit = Integer(ls_digit)
ls_result = ls_result + ls_const_CC_number[li_digit + 1] &
+ ls_fen

IF ar_amount < 0 THEN
ls_result = ls_negtive + ls_result
END IF

RETURN ls_result
justlove 2002-01-25
  • 打赏
  • 举报
回复
有没有简单点算法?
justlove 2002-01-25
  • 打赏
  • 举报
回复
复杂啊!!!
programbcb 2002-01-25
  • 打赏
  • 举报
回复
case(len(s_je) when 4 then
((case(mid(s_je,1,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '元' + (case(mid(s_je,3,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '角' +
(case(mid(s_je,4,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '分')
when 5 then
((case(mid(s_je,1,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '拾' + (case(mid(s_je,2,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '元' +
(case(mid(s_je,4,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '角' + (case(mid(s_je,5,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '分')
when 6 then
((case(mid(s_je,1,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '佰' + (case(mid(s_je,2,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '拾' +
(case(mid(s_je,3,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '元' + (case(mid(s_je,5,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '角'+ (case(mid(s_je,6,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '分')
when 7 then
((case(mid(s_je,1,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '仟' + (case(mid(s_je,2,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '佰' +
(case(mid(s_je,3,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '拾' + (case(mid(s_je,4,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '元'+ (case(mid(s_je,6,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '角' + (case(mid(s_je,7,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '分')
when 8 then
((case(mid(s_je,1,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '万' + (case(mid(s_je,2,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '仟' +
(case(mid(s_je,3,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '佰' + (case(mid(s_je,4,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '拾'+ (case(mid(s_je,5,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '元' + (case(mid(s_je,7,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '角' + (case(mid(s_je,8,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '分')
when 9 then
((case(mid(s_je,1,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '拾' + (case(mid(s_je,2,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '万' +
(case(mid(s_je,3,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '仟' + (case(mid(s_je,4,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '佰'+ (case(mid(s_je,5,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '拾' + (case(mid(s_je,6,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '元' + (case(mid(s_je,8,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '角' + (case(mid(s_je,9,1) when '1' then '壹' when '2' then '贰' when '3' then '叁' when '4' then '肆' when '5' then '伍' when '6' then '陆' when '7' then '柒' when '8' then '捌' when '9' then '玖' else '零')) + '分'))
其中s_je表示字符串类型的数字
xiezhsh3 2002-01-25
  • 打赏
  • 举报
回复
给你程序,要不要啊
小灰灰 2002-01-25
  • 打赏
  • 举报
回复

choose case
。。。。。。
end choose

不行么?

401

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 非技术版
社区管理员
  • 非技术版社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧