asp.net(vb)实现金额转换成大写的函数

决定转身就不要频频回头,酷的人才会被记得久一些。早安!没什么可懊恼的,能被拆散的,其实都不是属于你的,继续下一个吧。早安!
 
''' <summary>
''' 将数据转换为Double数字
''' </summary>
''' <param name="Obj"></param>
''' <returns></returns>
''' <remarks></remarks>
Public Shared Function todbl(ByVal Obj As Object) As Double
If Obj Is DBNull.Value Then
Return 0
ElseIf IsNumeric(Obj) = False Then
Return 0
Else
Return Obj
End If
End Function

 
''' <summary>
''' 将金额转换成大写
''' </summary>
''' <param name="Money">金额</param>
''' <returns></returns>
''' <remarks></remarks>
Public Shared Function UpperMoney(ByVal Money As String) As String
Money = todbl(Money).ToString("0.00")
Dim strFuShu As String = IIf(Money.StartsWith("-"), "负", "")
Money = Money.Replace("-", "").Replace(".", "")
Dim Number As String = "零壹贰叁肆伍陆柒捌玖"
Dim Unit As String = "分角元拾佰仟万拾佰仟亿拾佰仟万"
Dim str As String
For i As Integer = 0 To Money.Length - 1
Dim c As String = Money.Chars(i)
Dim Index As Integer = Money.Length - 1 - i
str &= Number(c) & Unit(Index)
Next
str = strFuShu & str & "整"
Return str
End Function

到此这篇关于asp.net(vb)实现金额转换成大写的函数就介绍到这了。只有经历过地狱般的折磨,才有征服天堂的力量。只有流过血的手指才能弹出世间的绝唱。更多相关asp.net(vb)实现金额转换成大写的函数内容请查看相关栏目,小编编辑不易,再次感谢大家的支持!

您可能有感兴趣的文章
ASP.NET中Response.BufferOutput属性的使用技巧

ASP.NET轻量级MVC框架Nancy的基本用法

使用grpcui测试ASP.NET core的gRPC服务

ASP.NET Core中的对象池介绍

.NET集成ORM框架HiSql