Ąšćóģåķņū: n - ńóģģą: rub - (false - įåē źīļååź, true - ļīėķīńņüž)
Ķąēķą÷åķčå: Źīķāåšņčšóåņ ńóģģó ā ńóģģó ļšīļčńüž
Āīēāšąłąåņ: Ńóģģó ļšīļčńüž (Äāąäöąņü ļ’ņü šóįėåé 33 źīļåéźč.)
Private Skl As Byte
Public Function NumStr(n As Currency, Optional rub As Boolean = True) As String
Dim s As String, R As String, K As String
Dim t, u, v, w As Integer
s = ""
If n < 0 Then
n = Abs(n)
s = "ģčķóń"
End If
v = (n - Fix(n)) * 100
w = Val(right(Format(v), 1))
n = Fix(n)
t = Val(right(Format(n), 2))
u = Val(right(t, 1))
If t > 10 And t < 15 Then
R = " šóįėåé"
ElseIf u = 1 Then
R = " šóįėü"
ElseIf u > 1 And u < 5 Then
R = " šóįė’"
Else
R = " šóįėåé"
End If
If v > 10 And v < 15 Then
K = " źīļååź."
ElseIf w = 1 Then
K = " źīļåéźą."
ElseIf w > 1 And w < 5 Then
K = " źīļåéźč."
Else
K = " źīļååź."
End If
If n > 1000000000000# Then
s = AddStr(s, NumStr2(Int(n / 1000000000000#), True))
Select Case Skl
Case 0
s = AddStr(s, "ņščėėčīķ")
Case 1
s = AddStr(s, "ņščėėčīķą")
Case 2
s = AddStr(s, "ņščėėčīķīā")
End Select
n = n - Int(n / 1000000000000#) * 1000000000000#
End If
If n > 1000000000 Then
s = AddStr(s, NumStr2(Int(n / 1000000000), True))
Select Case Skl
Case 0
s = AddStr(s, "ģčėėčąšä")
Case 1
s = AddStr(s, "ģčėėčąšäą")
Case 2
s = AddStr(s, "ģčėėčąšäīā")
End Select
n = n - Int(n / 1000000000) * 1000000000
End If
If n > 1000000 Then
s = AddStr(s, NumStr2(n \ 1000000, True))
Select Case Skl
Case 0
s = AddStr(s, "ģčėėčīķ")
Case 1
s = AddStr(s, "ģčėėčīķą")
Case 2
s = AddStr(s, "ģčėėčīķīā")
End Select
n = n Mod 1000000
End If
If n > 1000 Then
s = AddStr(s, NumStr2(n \ 1000, False))
Select Case Skl
Case 0
s = AddStr(s, "ņūń’÷ą")
Case 1
s = AddStr(s, "ņūń’÷č")
Case 2
s = AddStr(s, "ņūń’÷")
End Select
n = n Mod 1000
End If
If n > 0 Then
s = AddStr(s, NumStr2(n, True))
End If
If s = "" Then
s = "ķīėü"
ElseIf s = "ģčķóń" Then
s = s + " ķīėü"
End If
'NumStr = StrConv(Mid(s, 1, 1), vbUpperCase) + Mid(s, 2, Len(s) - 1)
NumStr = UCase(Left(Trim(s), 1)) & LCase(Mid(Trim(s), 2))
If (rub) Then NumStr = NumStr & R & Format(v, " 00") & K
End Function
Private Function NumStr2(n As Currency, male As Boolean) As String
Dim s As String
s = ""
If n >= 100 Then
s = NumStr1(((n \ 100) * 100), male)
n = n Mod 100
End If
If n >= 20 Then
s = AddStr(s, NumStr1(((n \ 10) * 10), male))
n = n Mod 10
End If
NumStr2 = AddStr(s, NumStr1(n, male))
End Function
Private Function NumStr1(n As Currency, male As Boolean) As String
Skl = 2
Select Case n
Case 100
NumStr1 = "ńņī"
Case 200
NumStr1 = "äāåńņč"
Case 300
NumStr1 = "ņščńņą"
Case 400
NumStr1 = "÷åņūšåńņą"
Case 500
NumStr1 = "ļ’ņüńīņ"
Case 600
NumStr1 = "ųåńņüńīņ"
Case 700
NumStr1 = "ńåģüńīņ"
Case 800
NumStr1 = "āīńåģüńīņ"
Case 900
NumStr1 = "äåā’ņüńīņ"
Case 11
NumStr1 = "īäčķķąäöąņü"
Case 12
NumStr1 = "äāåķąäöąņü"
Case 13
NumStr1 = "ņščķąäöąņü"
Case 14
NumStr1 = "÷åņūšķąäöąņü"
Case 15
NumStr1 = "ļ’ņķąäöąņü"
Case 16
NumStr1 = "ųåńņķąäöąņü"
Case 17
NumStr1 = "ńåģķąäöąņü"
Case 18
NumStr1 = "āīńåģķąäöąņü"
Case 19
NumStr1 = "äåā’ņķąäöąņü"
Case 20
NumStr1 = "äāąäöąņü"
Case 30
NumStr1 = "ņščäöąņü"
Case 40
NumStr1 = "ńīšīź"
Case 50
NumStr1 = "ļ’ņüäåń’ņ"
Case 60
NumStr1 = "ųåńņüäåń’ņ"
Case 70
NumStr1 = "ńåģüäåń’ņ"
Case 80
NumStr1 = "āīńåģüäåń’ņ"
Case 90
NumStr1 = "äåā’ķīńņī"
Case 1
Skl = 0
If male Then
NumStr1 = "īäčķ"
Else
NumStr1 = "īäķą"
End If
Case 2
Skl = 1
If male Then
NumStr1 = "äāą"
Else
NumStr1 = "äāå"
End If
Case 3
Skl = 1
NumStr1 = "ņšč"
Case 4
Skl = 1
NumStr1 = "÷åņūšå"
Case 5
NumStr1 = "ļ’ņü"
Case 6
NumStr1 = "ųåńņü"
Case 7
NumStr1 = "ńåģü"
Case 8
NumStr1 = "āīńåģü"
Case 9
NumStr1 = "äåā’ņü"
Case 10
NumStr1 = "äåń’ņü"
End Select
End Function
Private Function AddStr(S1 As String, S2 As String)
If S1 = "" Then
AddStr = S2
ElseIf S2 = "" Then
AddStr = S1
Else
AddStr = S1 + " " + S2
End If
End Function