The document describes a module that converts numeric values to their word representations in Indonesian. It includes:
1) Private variables to store the dictionary (_Kamus) mapping numbers to their word forms and array of number group suffixes.
2) InitializeKamus method to populate the _Kamus dictionary.
3) Terbilang function that takes a double, converts it to a string, separates the integer and decimal portions, iterates through number groups to convert each portion to words, and returns the result.
4) BacaGroupAngka helper function to convert a given number group to words based on its value and position, using the _Kamus dictionary.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
90 views3 pages
Terbilang
The document describes a module that converts numeric values to their word representations in Indonesian. It includes:
1) Private variables to store the dictionary (_Kamus) mapping numbers to their word forms and array of number group suffixes.
2) InitializeKamus method to populate the _Kamus dictionary.
3) Terbilang function that takes a double, converts it to a string, separates the integer and decimal portions, iterates through number groups to convert each portion to words, and returns the result.
4) BacaGroupAngka helper function to convert a given number group to words based on its value and position, using the _Kamus dictionary.
Public Function Terbilang(Bilangan As Double) As String
Dim sRet As String = "" Dim sMinus As String = "" Dim BilCacah As Double = 0 Dim BilPecahan As Integer = 0
InitializeKamus()
Try If Bilangan < 0 Then sMinus = "Minus "
Dim grp() As String =
Split(Math.Abs(Bilangan).ToString(System.Globalization.NumberFormatInfo.CurrentInfo ), System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator) If grp.Length > 1 Then BilCacah = CDbl(grp(0)) BilPecahan = CInt(grp(1)) Else BilCacah = Bilangan End If
Dim triple() As String = Split(BilCacah.ToString("#,##0",
sRet = sRet & BacaGroupAngka(triple(i), False, IIf(i > 5, i - 5 + 1, i)) Next
If BilPecahan > 0 Then
sRet = sRet & " Koma" & BacaGroupAngka(BilPecahan, True) End If
sRet = sMinus & sRet
Catch ex As Exception MsgBox(ex.Message, vbOKOnly, "Parsing Bilangan")
End Try
_Kamus.Clear() _Kamus = Nothing
Return sRet.Trim End Function
Private Function BacaGroupAngka(ByVal Angka As Integer, _
Optional IsPecahan As Boolean = False, _ Optional iGroup As Byte = 0) As String Dim sRet As String = "" Dim sAngka As String = Angka.ToString("000")
Select Case IsPecahan
Case True Try For i As Integer = 0 To sAngka.Length - 1 If CInt(sAngka.Substring(i, 1)) = 0 Then sRet = sRet & "Nol" Else sRet = sRet & _Kamus(CInt(sAngka.Substring(i, 1))) End If Next Catch ex As Exception MsgBox(ex.Message, vbOKOnly, "Baca Pecahan") End Try Case Else Try If Angka = 1 And iGroup = 1 Then sRet = " Seribu" ElseIf _Kamus.ContainsKey(Angka) Then sRet = _Kamus(Angka) & _ArGroup(iGroup) Else Dim Satuan As String = _Kamus(CInt(sAngka.Substring(2, 1))) Dim puluhan As String = "" Dim ratusan As String = ""
If _Kamus.ContainsKey(CInt(sAngka.Substring(1, 2))) Then
puluhan = _Kamus(CInt(sAngka.Substring(1, 2))) Else If CInt(sAngka.Substring(1, 1)) = 0 Then puluhan = Satuan ElseIf CInt(sAngka.Substring(1, 1)) = 1 Then puluhan = Satuan & " Belas" Else puluhan = _Kamus(CInt(sAngka.Substring(1, 1))) & " Puluh" & Satuan End If End If
If CInt(sAngka.Substring(0, 1)) = 0 Then
ratusan = puluhan ElseIf CInt(sAngka.Substring(0, 1)) = 1 Then ratusan = " Seratus" & puluhan Else ratusan = _Kamus(CInt(sAngka.Substring(0, 1))) & " Ratus" & puluhan End If
sRet = ratusan & _ArGroup(iGroup)
End If Catch ex As Exception MsgBox(ex.Message, vbOKOnly, "Baca Bilangan Bulat") End Try End Select
Solution Manual for Biocalculus Calculus Probability and Statistics for the Life Sciences 1st Edition by Stewart Day ISBN 1305114035 9781305114036 - Download PDF
Introduction to Plasmas and Plasma Dynamics With Reviews of Applications in Space Propulsion Magnetic Fusion and Space Physics 1st Edition Tang - Read the ebook online or download it for the best experience