pb中将金额转化为人民币大写


string cn_n[10] = {"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"} //   大写0-9
string cn_c[18] = {"分","角","元","拾","佰","仟","万","拾","佰","仟","亿","拾","佰","仟","万","拾","佰","仟"}
string ls_number,ls_rc
integer li_pos,li_for,li_len
If number < 0 Then ls_rc = "负"
ls_number = string(ABS(Number) * 100,"0")
li_len = Len(ls_number)
If li_len > UpperBound(cn_c) Then Return ''
For li_for = 1 To li_len
   li_pos = Integer(Mid(ls_number,li_for,1))
   If li_pos <> 0 Then      ////   非零值的处理,很简单
      ls_rc += cn_n[li_pos + 1] + cn_c[li_len - li_for + 1]
   ElseIf Mod(li_len - li_for - 2,4) = 0 Then   ///元、万、亿、万亿进位
      If Right(ls_rc,2) = cn_n[1] Then ls_rc = Left(ls_rc,Len(ls_rc) - 2)
      If li_len - li_for <> 6 Or Right(ls_rc,2) <> "亿" Then ls_rc += cn_c[li_len - li_for + 1]
      ls_rc += cn_n[1]
   ElseIf Right(ls_rc,2) <> cn_n[1] Then
      ls_rc += cn_n[1]
   End If
Next
If Right(ls_rc,2) = cn_n[1] Then ls_rc = Left(ls_rc,Len(ls_rc) - 2)
If Right(ls_rc,2) = "元" Then ls_rc += "整"
Return ls_rc

展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客
应支付0元
点击重新获取
扫码支付

支付成功即可阅读