The original source is from here:
http://oyongweb.com/blog/?p=67
So first step is you need to create 4 function, first function is:
view source
print?
01 Function Bilangan (x as Number)
02 Select Case x
03 Case 0
04 Bilangan = ""
05 case 1
06 Bilangan = "satu "
07 case 2
08 Bilangan = "dua "
09 case 3
10 Bilangan = "tiga "
11 case 4
12 Bilangan = "empat "
13 case 5
14 Bilangan = "lima "
15 case 6
16 Bilangan = "enam "
17 case 7
18 Bilangan = "tujuh "
19 case 8
20 Bilangan = "delapan "
21 case 9
22 Bilangan = "sembilan "
23 case 10
24 Bilangan = "sepuluh "
25 case 11
26 Bilangan = "sebelas "
27
28 End Select
29
30 End Function
Second Function
view source
print?
01 Function DictDown (x as Number) as String
02 Select Case x
03 Case 0
04 DictDown = "ratus "
05 case 1
06 DictDown = ""
07 case 2
08 DictDown = "puluh "
09 End Select
10
11 End Function
Third Function
view source
print?
01 Function DictUp (x as Number) as string
02 Select Case x
03 Case 0
04 DictUp = ""
05 case 1
06 DictUp = "ribu "
07 case 2
08 DictUp = "juta "
09 case 3
10 DictUp = "milyar "
11 case 4
12 DictUp = "triliun"
13 End Select
14
15 End Function
Last Function that we will be using to call the converter is:
view source
print?
01 Function getTerbilang (x as Number) as String
02 Dim out as String
03 dim inp as String
04 dim temp as string
05 dim temp2 as string
06 dim add as string
07 Dim pjg, j As Number
08 Dim flagEmpty As Boolean
09 flagEmpty = True
10 out = ""
11 inp = cstr (x,0,"","")
12 pjg = Len(inp)
13 temp = ""
14 temp2 = ""
15
16 For j = 0 To pjg - 1 Step 1
17 temp = Mid(inp,j+1, 1)
18
19 If (pjg - j) Mod 3 = 0 Then
20 flagEmpty = True
21 End If
22
23 If temp = "0" Then
24 add = ""
25 ElseIf temp = "1" And ((pjg - j) Mod 3 <> 1 Or (j = 0 And pjg <> 1)) Then
26 add = ""
27 If (pjg - j) Mod 3 = 2 Then
28 temp2 = Mid(inp,j + 2, 1) 'if 12, then read the 2
29 If temp2 = "1" Or temp2 = "0" Then
30 add = add & "Se"
31 Else
32 add = add & bilangan(cdbl(temp2))
33 End If
34 If temp2 = "0" Then
35 add = add & "puluh "
36 Else
37 add = add & "belas "
38 End If
39
40 j = j + 1 'This part read two number simultaneusly Example 112 it read 12 both.
41 Else
42 add = "Se"
43 add = add & dictDown((pjg - j) Mod 3)
44 End If
45
46 flagEmpty = False
47 Else
48 add = bilangan(CDbl(temp)) & dictDown((pjg - j) Mod 3)
49 flagEmpty = False
50 End If
51
52 If (pjg - j) Mod 3 = 1 And flagEmpty = False Then
53 add = add & dictUp((pjg - j - 1) \ 3)
54 End If
55
56 out = out & add
57
58 Next
59 temp = UCase(Left(out, 1))
60 temp2 = Mid(out,2)
61 out = temp & temp2
62 getTerbilang = out
63
64 End Function
How to use it:
Very simple, in formula editor just call the function like this getTerbilang(25000), and it will return Dua puluh lime ribu
Search Here
MyLot Discussion
Wednesday, March 10, 2010
Function Terbilang in Indonesian (Crystal Report)
Posted By Admin 1 komentar
Reset Identity Column in SQL SERVER
The original source from http://geekswithblogs.net/TakeNote/archive/2007/11/30/117258.aspx
The following line resets the Identity value for the Customer table to 0 so that the next record added starts at 1.
DBCC CHECKIDENT('Customer', RESEED, 0)
Posted By Admin 0 komentar
Label: SQL Server 2005
Tuesday, June 30, 2009
Deaf to Win
Better be deaf than normal, so every time you want to climb the highest mountain, you will not hear someone says "The mountain is too high!!! No one can climb that mountain!!!"
Posted By Admin 0 komentar
Label: Life Quote
Subscribe to:
Posts (Atom)