| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1987 人关注过本帖
标题:最少代码把数字转换成人民币大写
取消只看楼主 加入收藏
singlion
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2007-6-16
收藏
 问题点数:0 回复次数:0 
最少代码把数字转换成人民币大写
Dim num As Long, num_t As Long, i As Long, l As Long
Dim rmb As String, rmb_char As String, rmb_weight As String
l = Len(Text1.Text)
For i = l To 1 Step -1
num_t = num
num = Mid(Text1.Text, l - i + 1, 1)
If num_t = num And num = 0 Then GoTo ooo

rmb_char = IIf(num = 0, "零", Choose(num, "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"))
rmb_weight = Choose(i, "", "拾", "佰", "仟", "萬", IIf(Mid(Text1.Text, l - i + 2, 1) = 0, "拾萬", "拾"), "佰", "仟", "萬", "亿", IIf(Mid(Text1.Text, l - i + 2, 1) = 0, "拾亿", "拾"), "佰", "仟", "萬")
rmb = rmb & rmb_char & IIf(num = 0, "", rmb_weight)
ooo:
Next i
MsgBox rmb
搜索更多相关主题的帖子: num 人民币 数字 Long 
2007-11-15 12:54
快速回复:最少代码把数字转换成人民币大写
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.041697 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved