`
txf2004
  • 浏览: 6853042 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

asp金额大小写转换

ASP 
阅读更多

<!--#include file=common.asp-->
<%
dim tmpnum
'从第一张页面传过来的小写金额
tmpnum=request("page1num")
'调用并显示大写金额
response.write rmb(cdbl(tmpnum))
response.end
%>


common.asp
<%
Function rmb(num)

num = FormatNumber(num, 2)
Dim numList
Dim rmbList
Dim numLen
Dim numChar
Dim numstr
Dim n
Dim n1, n2
Dim hz
numList = "零壹贰叁肆伍陆柒捌玖"
rmbList = "分角元拾佰仟万拾佰仟亿拾佰仟万"

If num > 9999999999999.99 Then
rmb = "超出范围的人民币值"
Exit Function
End If

numstr = CStr(num * 100)
numLen = Len(numstr)
n = 1
Do While n <= numLen
numChar = CInt(Mid(numstr, n, 1))
n1 = Mid(numList, numChar + 1, 1)
n2 = Mid(rmbList, numLen - n + 1, 1)
If Not n1 = "零" Then
hz = hz + CStr(n1) + CStr(n2)
Else
If n2 = "亿" Or n2 = "万" Or n2 = "元" Or n1 = "零" Then
Do While Right(hz, 1) = "零"
hz = Left(hz, Len(hz) - 1)
Loop
End If
If (n2 = "亿" Or (n2 = "万" And Right(hz, 1) <> "亿") Or n2 = "元") Then
hz = hz + CStr(n2)
Else
If Left(Right(hz, 2), 1) = "零" Or Right(hz, 1) <> "亿" Then
hz = hz + n1
End If
End If
End If
n = n + 1
Loop
Do While Right(hz, 1) = "零"
hz = Left(hz, Len(hz) - 1)
Loop
If Right(hz, 1) = "元" Then
hz = hz + "整"
End If
rmb = hz
End Function

%>

分享到:
评论

相关推荐

    ASP.NET常用代码

    写在DataGrid的_ItemDataBound里 if (e.Item.ItemType == ListItemType.Item ||e.Item.ItemType == ListItemType.AlternatingItem) { e.Item.Attributes.Add("onmouseover","this.style.backgroundColor='#99cc00';...

    ASP.NET程序中常用的三十三种代码.txt

     写在DataGrid的_ItemDataBound里 if (e.Item.ItemType == ListItemType.Item ||e.Item.ItemType == ListItemType.AlternatingItem) { e.Item.Attributes.Add("onmouseover","this.style.backgroundColor=’#99cc00...

    [ASP]xiaoshuoguanli整站系统

    本人仅业余学习一些基础的ASP知识以供系统设计之用,并非专业人员,相关服务器设置、MSSQL/MySQL数据库方面的专业问题请自行解决。 本人仅提供本系统相关的一些技术问题的解释、解答。 运行环境: 服务器需要: ...

    C#公共通用类

    转换人民币大小金额辅助类(RMBUtil.cs) 常用的字符串常量(StringConstants.cs) 简要说明TextHelper。(StringUtil.cs) 获取中文字首字拼写,随机发生器,按指定概率随机执行操作(Util.cs) 各种输入格式验证辅助类...

    C#公共类通用类非常齐全

    转换人民币大小金额辅助类(RMBUtil.cs) 常用的字符串常量(StringConstants.cs) 简要说明TextHelper。(StringUtil.cs) 获取中文字首字拼写,随机发生器,按指定概率随机执行操作(Util.cs) 各种输入格式验证辅助类...

    C#公共类源代码 带帮助文档

    转换人民币大小金额辅助类(RMBUtil.cs) 常用的字符串常量(StringConstants.cs) 简要说明TextHelper。(StringUtil.cs) 获取中文字首字拼写,随机发生器,按指定概率随机执行操作(Util.cs) 各种输入格式验证...

    WHC.OrderWater.Commons公共类源码_文档[最新整理]

    转换人民币大小金额辅助类(RMBUtil.cs) 常用的字符串常量(StringConstants.cs) 简要说明TextHelper。(StringUtil.cs) 获取中文字首字拼写,随机发生器,按指定概率随机执行操作(Util.cs) 各种输入格式验证...

    WHC.OrderWater.Commons 伍华聪 公共类源码 类库 帮助文档

    转换人民币大小金额辅助类(RMBUtil.cs) 常用的字符串常量(StringConstants.cs) 简要说明TextHelper。(StringUtil.cs) 获取中文字首字拼写,随机发生器,按指定概率随机执行操作(Util.cs) 各种输入格式验证...

    C#编程经验技巧宝典

    85 &lt;br&gt;0130 复制字符串中指定的字符 85 &lt;br&gt;0131 巧截字符串的数字 86 &lt;br&gt;0132 如何存储变长字符串 86 &lt;br&gt;0133 在进行字符串比较时忽略大小写 87 &lt;br&gt;0134 如何去除字符串尾空格 87 ...

    PHP程序开发范例宝典III

    实例250 使用格式化函数转换查询条件的数据类型 385 实例251 在查询中使用字符串函数 387 实例252 在查询中使用日期函数 388 8.19 having语句应用 390 实例253 利用having语句过滤分组数据 390 ...

    《Excel应用大全》示例文件 光盘文件

    • 更改数据字母大小写 • 利用MID 函数提取身份证号码中的8 位生日数字 • 使用文本提取函数进行数字分列 • 使用查找函数拆分空格分隔的数据 • 实现EAN-13条码的校验位的算法 • 利用文本查找函数进行模糊查找 •...

Global site tag (gtag.js) - Google Analytics