Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Function SpellNumberIND(ByVal Numb As Double) As String
- Dim intPoint As Integer
- Dim mantissa As Double
- Dim expo As Double
- Dim StrNum, strTemp As String
- Dim strLen As Integer
- Dim lenman As Integer
- Dim tempExpo As Integer
- StrNum = Format(Numb.ToString)
- If InStr(1, StrNum, "+") > 0 Then
- SpellNumberIND = "HUNDRED CRORE +"
- Exit Function
- End If
- strLen = Len(StrNum)
- intPoint = InStr(1, StrNum, ".")
- If intPoint = 0 Then GoTo expozero
- mantissa = Val(Mid(StrNum, 1, intPoint - 1))
- lenman = Len(Mid(StrNum, 1, intPoint))
- expo = Val(Mid(StrNum, lenman + 1, intPoint + 2))
- tempExpo = Left(expo, 2)
- strTemp = Mid(StrNum, lenman + 1, intPoint + 2)
- If LeftStr(strTemp, 1) <> "0" Then
- If Len(tempExpo.ToString) = 1 Then
- tempExpo = tempExpo & 0
- End If
- End If
- GoTo mantzero
- expozero:
- mantissa = StrNum
- mantzero:
- 'If frmNoToWords.chkPrefix.CheckState = CheckState.Checked Then
- If mantissa = 0 And expo = 0 Then
- 'MsgBox("ZERO AMOUNT")
- SpellNumberIND = "ZERO ONLY."
- Exit Function
- End If
- If mantissa = 0 And expo <> 0 Then
- SpellNumberIND = UCase(" PAISE" & ToWord(tempExpo) & " ONLY.")
- Exit Function
- End If
- If expo = 0 Then
- SpellNumberIND = UCase("RUPEES " & ToWord(mantissa) & " ONLY.")
- ElseIf expo <> 0 Then
- SpellNumberIND = UCase("RUPEES " & ToWord(mantissa) & "" & " AND" & IIf(tempExpo = 0, "", " PAISE " & ToWord(tempExpo) & "") & " ONLY.")
- Else
- SpellNumberIND = UCase("RUPEES " & ToWord(mantissa) & " ONLY.")
- End If
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement