複製代碼 代碼如下:''' <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