This function takes a numeric string as input and converts it to an Indonesian language word representation. It first checks if the number is empty, then extracts the fractional part. It initializes various variables to store the word components and loop through each digit of the number. Based on the digit value and its position, it selects the appropriate word components like "Satu", "Puluh", "Ratus" to build up the word representation. Finally it combines the word for the whole number part and fractional part and returns the final terbilang string.
This function takes a numeric string as input and converts it to an Indonesian language word representation. It first checks if the number is empty, then extracts the fractional part. It initializes various variables to store the word components and loop through each digit of the number. Based on the digit value and its position, it selects the appropriate word components like "Satu", "Puluh", "Ratus" to build up the word representation. Finally it combines the word for the whole number part and fractional part and returns the final terbilang string.
This function takes a numeric string as input and converts it to an Indonesian language word representation. It first checks if the number is empty, then extracts the fractional part. It initializes various variables to store the word components and loop through each digit of the number. Based on the digit value and its position, it selects the appropriate word components like "Satu", "Puluh", "Ratus" to build up the word representation. Finally it combines the word for the whole number part and fractional part and returns the final terbilang string.
This function takes a numeric string as input and converts it to an Indonesian language word representation. It first checks if the number is empty, then extracts the fractional part. It initializes various variables to store the word components and loop through each digit of the number. Based on the digit value and its position, it selects the appropriate word components like "Satu", "Puluh", "Ratus" to build up the word representation. Finally it combines the word for the whole number part and fractional part and returns the final terbilang string.
Private Function Terbilang(Angka As String ) As String
Dim strJmlHuruf$, intPecahan As Integer, strPecahan$, Urai$, Bil1$, strTot$, Bil2$ Dim X, Y, z As Integer
If Angka = "" Then Exit Function
strJmlHuruf = LTrim(Angka) intPecahan = Val(Right(Mid(Angka, 15, 2), 2)) If (intPecahan = 0) Then strPecahan = "" Else strPecahan = LTrim(Str(intPecahan)) + "10/100" End If X = 0 Y = 0 Urai = "" While (X < Len(strJmlHuruf)) X = X + 1 strTot = Mid(strJmlHuruf, X, 1) Y = Y + Val(strTot) z = Len(strJmlHuruf) - X + 1 Select Case Val(strTot) Case 1 If (z = 1 Or z = 7 Or z = 10 Or z = 13) Then Bil1 = "Satu " ElseIf (z = 4) Then If (X = 1) Then Bil1 = "Se" ElseIf (z = 2 Or z = 5 Or z = 8 Or z = 11 Or z = Then Bil2 = "" Case 0 Bil1 = "Sepuluh " Bil1 = "Sebelas " Case 2 Bil1 = "Dua Belas " Case 3 Bil1 = "Tiga Belas " Case 4 Bil1 = "Empat Belas " Case 5 Bil1 = "Lima Belas " Case 6 Bil1 = "Enam Belas " Case 7 Bil1 = "Tujuh Belas " Case 8 Bil1 = "Delapan Belas " Case 9 Bil1 = "Sembilan Belas " End Select Bil1 = "Dua " Case 3 Bil1 = "Tiga " Case 4 Bil1 = "Empat " Case 5 Bil1 = "Lima " Case 6 Bil1 = "Enam " Case 7 Bil1 = "Tujuh " Case 8 Bil1 = "Delapan " Case 9 Bil1 = "Sembilan " Case Else Bil1 = "" End Select If (Val(strTot) > 0) Then If (z = 2 Or z = 5 Or z = 8 Or z = 11 Or z = 14) Then Bil2 = "Puluh " ElseIf (z = 3 Or z = 6 Or z = 9 Or z = 12 Or z = 15) Then Bil2 = "Ratus " Bil2 = "" Bil2 = "" If (Y > 0) Then Select Case z Bil2 = Bil2 + "Ribu " Bil2 = Bil2 + "Juta " Case 10 Bil2 = Bil2 + "Milyar " Case 13 Bil2 = Bil2 + "Trilyun " Urai = Urai + Bil1 + Bil2 Wend Urai = Urai + strPecahan Terbilang = Urai & " Rupiah" End Function