'Create by sopian
'26 may 05
'function:
'itoc : mengkonversi integer ke karakter
'ctoi : mengkonversi karakter ke integer
'catatan : fungsi ini hanya berlaku untuk integer 1 sampai 702 atau
(26 x 26)+26
' untuk nilai diatas angka tersebut anda harus
memodifikasinya
'---------------------------------------------------------------------
----------
'contoh:
'debug.print itoc(26)
'debug.print ctoi("z")
Private Function itoc(ByVal n As Integer) As String
Dim arr_data() As String
Dim m_text As String
Dim m_bagi As Integer, nchar As String
m_text = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"
arr_data = Split(m_text, ",")
If n < 27 Then
itoc = arr_data(n - 1)
Else
m_bagi = n \ 26
nchar = n Mod 26
If nchar = 0 Then nchar = 1
itoc = arr_data(m_bagi - 1) & arr_data(nchar - 1)
End If
End Function
Private Function ctoi(ByVal s As String) As Integer
Dim n As Integer, b As Integer
If Len(Trim(s)) = 1 Then
ctoi = Asc(ucase(s)) - 64
ElseIf Len(Trim(s)) = 2 Then
n = Asc(Left$(ucase(s), 1)) - 64
b = Asc(Right$(ucase(s), 1)) - 64
ctoi = (n * 26) + b
End If
End Function
'coba gunakan atau modifikasi fungsi ini, smoga berhasil..
Untuk keluar dari millis ini, kirim email kosong ke:
[EMAIL PROTECTED]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Programmer-VB/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/