Aşağıdaki TutarYazisi fonksiyonu Double tipindeki bir sayının okunuşunu metin olarak geri döndürür.
Kullanılışı: msgbox TutarYazisi(12450)
'OnİkiBinDörtYüzElli' şeklinde bir metin döndürür.
Not: UcluSayiAyir sadece TutarYazisi fonksiyonunun kullandığı bir fonksiyondur.
Private Function TutarYazisi(ByVal Sayi As Double) As String
Dim tmpSayi As Double
Dim tmpUcluGrup As Double
Dim Buffer As String
Buffer = ""
tmpSayi = Sayi
If Int(tmpSayi / 1000000000000#) <> 0 Then
tmpUcluGrup = Int(tmpSayi / 1000000000000#) 'Trilyon
Buffer = Buffer & UcluSayiAyir(tmpUcluGrup) & "Trilyon"
tmpSayi = tmpSayi - (tmpUcluGrup * 1000000000000#)
End If
If Int(tmpSayi / 1000000000) <> 0 Then
tmpUcluGrup = Int(tmpSayi / 1000000000) 'Milyar
Buffer = Buffer & UcluSayiAyir(tmpUcluGrup) & "Milyar"
tmpSayi = tmpSayi - (tmpUcluGrup * 1000000000)
End If
If Int(tmpSayi / 1000000) <> 0 Then
tmpUcluGrup = Int(tmpSayi / 1000000) 'Milyon
Buffer = Buffer & UcluSayiAyir(tmpUcluGrup) & "Milyon"
tmpSayi = tmpSayi - (tmpUcluGrup * 1000000)
End If
If Int(tmpSayi / 1000) <> 0 Then
tmpUcluGrup = Int(tmpSayi / 1000) 'Bin
If UcluSayiAyir(tmpUcluGrup) = "Bir" Then
Buffer = Buffer & "Bin"
Else
Buffer = Buffer & UcluSayiAyir(tmpUcluGrup) & "Bin"
End If
tmpSayi = tmpSayi - (tmpUcluGrup * 1000)
End If
If Int(tmpSayi / 1) <> 0 Then
tmpUcluGrup = Int(tmpSayi / 1) 'Bir
Buffer = Buffer & UcluSayiAyir(tmpUcluGrup)
tmpSayi = tmpSayi - (tmpUcluGrup * 1)
End If
TutarYazisi = Buffer
End Function
Private Function UcluSayiAyir(ByVal intSayi As Integer) As String
Dim Birli_Rakam(10) As String
Dim Onlu_Rakam(10) As String
Dim tmpSayi As Double
Dim tmpTekSayi As Byte
Dim Buffer As String
Birli_Rakam(1) = "Bir"
Birli_Rakam(2) = "İki"
Birli_Rakam(3) = "Üç"
Birli_Rakam(4) = "Dört"
Birli_Rakam(5) = "Beş"
Birli_Rakam(6) = "Altı"
Birli_Rakam(7) = "Yedi"
Birli_Rakam(8) = "Sekiz"
Birli_Rakam(9) = "Dokuz"
Onlu_Rakam(1) = "On"
Onlu_Rakam(2) = "Yirmi"
Onlu_Rakam(3) = "Otuz"
Onlu_Rakam(4) = "Kırk"
Onlu_Rakam(5) = "Elli"
Onlu_Rakam(6) = "Altmış"
Onlu_Rakam(7) = "Yetmiş"
Onlu_Rakam(8) = "Seksen"
Onlu_Rakam(9) = "Doksan"
Buffer = ""
tmpSayi = intSayi
If Int(tmpSayi / 100) <> 0 Then
tmpTekSayi = Int(tmpSayi / 100)
If tmpTekSayi = 1 Then
Buffer = Buffer & "Yüz"
Else
Buffer = Buffer & Birli_Rakam(tmpTekSayi) & "Yüz"
End If
tmpSayi = tmpSayi - (tmpTekSayi * 100)
End If
If Int(tmpSayi / 10) <> 0 Then
tmpTekSayi = Int(tmpSayi / 10)
If tmpTekSayi = 1 Then
Buffer = Buffer & "On"
Else
Buffer = Buffer & Onlu_Rakam(tmpTekSayi)
End If
tmpSayi = tmpSayi - (tmpTekSayi * 10)
End If
If Int(tmpSayi / 1) <> 0 Then
tmpTekSayi = Int(tmpSayi / 1)
Buffer = Buffer & Birli_Rakam(tmpTekSayi)
tmpSayi = tmpSayi - (tmpTekSayi * 1)
End If
UcluSayiAyir = Buffer
End Function
Bu kadar
Selametle
Kullanılışı: msgbox TutarYazisi(12450)
'OnİkiBinDörtYüzElli' şeklinde bir metin döndürür.
Not: UcluSayiAyir sadece TutarYazisi fonksiyonunun kullandığı bir fonksiyondur.
Private Function TutarYazisi(ByVal Sayi As Double) As String
Dim tmpSayi As Double
Dim tmpUcluGrup As Double
Dim Buffer As String
Buffer = ""
tmpSayi = Sayi
If Int(tmpSayi / 1000000000000#) <> 0 Then
tmpUcluGrup = Int(tmpSayi / 1000000000000#) 'Trilyon
Buffer = Buffer & UcluSayiAyir(tmpUcluGrup) & "Trilyon"
tmpSayi = tmpSayi - (tmpUcluGrup * 1000000000000#)
End If
If Int(tmpSayi / 1000000000) <> 0 Then
tmpUcluGrup = Int(tmpSayi / 1000000000) 'Milyar
Buffer = Buffer & UcluSayiAyir(tmpUcluGrup) & "Milyar"
tmpSayi = tmpSayi - (tmpUcluGrup * 1000000000)
End If
If Int(tmpSayi / 1000000) <> 0 Then
tmpUcluGrup = Int(tmpSayi / 1000000) 'Milyon
Buffer = Buffer & UcluSayiAyir(tmpUcluGrup) & "Milyon"
tmpSayi = tmpSayi - (tmpUcluGrup * 1000000)
End If
If Int(tmpSayi / 1000) <> 0 Then
tmpUcluGrup = Int(tmpSayi / 1000) 'Bin
If UcluSayiAyir(tmpUcluGrup) = "Bir" Then
Buffer = Buffer & "Bin"
Else
Buffer = Buffer & UcluSayiAyir(tmpUcluGrup) & "Bin"
End If
tmpSayi = tmpSayi - (tmpUcluGrup * 1000)
End If
If Int(tmpSayi / 1) <> 0 Then
tmpUcluGrup = Int(tmpSayi / 1) 'Bir
Buffer = Buffer & UcluSayiAyir(tmpUcluGrup)
tmpSayi = tmpSayi - (tmpUcluGrup * 1)
End If
TutarYazisi = Buffer
End Function
Private Function UcluSayiAyir(ByVal intSayi As Integer) As String
Dim Birli_Rakam(10) As String
Dim Onlu_Rakam(10) As String
Dim tmpSayi As Double
Dim tmpTekSayi As Byte
Dim Buffer As String
Birli_Rakam(1) = "Bir"
Birli_Rakam(2) = "İki"
Birli_Rakam(3) = "Üç"
Birli_Rakam(4) = "Dört"
Birli_Rakam(5) = "Beş"
Birli_Rakam(6) = "Altı"
Birli_Rakam(7) = "Yedi"
Birli_Rakam(8) = "Sekiz"
Birli_Rakam(9) = "Dokuz"
Onlu_Rakam(1) = "On"
Onlu_Rakam(2) = "Yirmi"
Onlu_Rakam(3) = "Otuz"
Onlu_Rakam(4) = "Kırk"
Onlu_Rakam(5) = "Elli"
Onlu_Rakam(6) = "Altmış"
Onlu_Rakam(7) = "Yetmiş"
Onlu_Rakam(8) = "Seksen"
Onlu_Rakam(9) = "Doksan"
Buffer = ""
tmpSayi = intSayi
If Int(tmpSayi / 100) <> 0 Then
tmpTekSayi = Int(tmpSayi / 100)
If tmpTekSayi = 1 Then
Buffer = Buffer & "Yüz"
Else
Buffer = Buffer & Birli_Rakam(tmpTekSayi) & "Yüz"
End If
tmpSayi = tmpSayi - (tmpTekSayi * 100)
End If
If Int(tmpSayi / 10) <> 0 Then
tmpTekSayi = Int(tmpSayi / 10)
If tmpTekSayi = 1 Then
Buffer = Buffer & "On"
Else
Buffer = Buffer & Onlu_Rakam(tmpTekSayi)
End If
tmpSayi = tmpSayi - (tmpTekSayi * 10)
End If
If Int(tmpSayi / 1) <> 0 Then
tmpTekSayi = Int(tmpSayi / 1)
Buffer = Buffer & Birli_Rakam(tmpTekSayi)
tmpSayi = tmpSayi - (tmpTekSayi * 1)
End If
UcluSayiAyir = Buffer
End Function
Bu kadar
Selametle