thanhhao > 06-07-17, 12:17 PM
tranthanhan1962 > 06-07-17, 02:04 PM
lehongduc > 08-07-17, 04:26 PM
lehongduc > 08-07-17, 04:30 PM
lehongduc > 09-07-17, 05:02 PM
UniArr = Split(UniStr, ",")
MhArr = Split(MhStr, ",")
Function mh(UnicodeText)
Dim LngSt As Integer
Dim i As Integer
Dim UniStr As String, MhStr As String
Dim UniArr, MhArr
Dim SubStr As String, k As Integer
Dim ReStr As String
'Tac dung: Ma hoa chuoi Unicode (UnicodeText)
UniStr = "," & ChrW(97) & "," & ChrW(224) & "," & ChrW(225) & "," & ChrW(7843) & "," & ChrW(227) & "," & ChrW(7841)
UniStr = UniStr & "," & ChrW(259) & "," & ChrW(7857) & "," & ChrW(7855) & "," & ChrW(7859) & "," & ChrW(7861) & "," & ChrW(7863)
UniStr = UniStr & "," & ChrW(226) & "," & ChrW(7847) & "," & ChrW(7845) & "," & ChrW(7849) & "," & ChrW(7851) & "," & ChrW(7853)
UniStr = UniStr & "," & ChrW(101) & "," & ChrW(232) & "," & ChrW(233) & "," & ChrW(7867) & "," & ChrW(7869) & "," & ChrW(7865)
UniStr = UniStr & "," & ChrW(234) & "," & ChrW(7873) & "," & ChrW(7871) & "," & ChrW(7875) & "," & ChrW(7877) & "," & ChrW(7879)
UniStr = UniStr & "," & ChrW(105) & "," & ChrW(236) & "," & ChrW(237) & "," & ChrW(7881) & "," & ChrW(297) & "," & ChrW(7883)
UniStr = UniStr & "," & ChrW(117) & "," & ChrW(249) & "," & ChrW(250) & "," & ChrW(7911) & "," & ChrW(361) & "," & ChrW(7909)
UniStr = UniStr & "," & ChrW(432) & "," & ChrW(7915) & "," & ChrW(7913) & "," & ChrW(7917) & "," & ChrW(7919) & "," & ChrW(7921)
UniStr = UniStr & "," & ChrW(111) & "," & ChrW(242) & "," & ChrW(243) & "," & ChrW(7887) & "," & ChrW(245) & "," & ChrW(7885)
UniStr = UniStr & "," & ChrW(244) & "," & ChrW(7891) & "," & ChrW(7889) & "," & ChrW(7893) & "," & ChrW(7895) & "," & ChrW(7897)
UniStr = UniStr & "," & ChrW(417) & "," & ChrW(7901) & "," & ChrW(7899) & "," & ChrW(7903) & "," & ChrW(7905) & "," & ChrW(7907)
UniStr = UniStr & "," & ChrW(100) & "," & ChrW(273)
UniStr = UniStr & "," & ChrW(121) & "," & ChrW(7923) & "," & ChrW(253) & "," & ChrW(7927) & "," & ChrW(7929) & "," & ChrW(7925)
MhStr = ",a00,a01,a02,a03,a04,a05" 'a
MhStr = MhStr & ",a10,a11,a12,a13,a14,a15" 'aw
MhStr = MhStr & ",a20,a21,a22,a23,a24,a25" 'â
MhStr = MhStr & ",e00,e01,e02,e03,e04,e05" 'e
MhStr = MhStr & ",e10,e11,e12,e13,e14,e15" 'ê
MhStr = MhStr & ",i00,i01,i02,i03,i04,i05" 'i
MhStr = MhStr & ",u00,u01,u02,u03,u04,u05" 'u
MhStr = MhStr & ",u10,u11,u12,u13,u14,u15" 'uw
MhStr = MhStr & ",o00,o01,o02,o03,o04,o05" 'o
MhStr = MhStr & ",o10,o11,o12,o13,o14,o15" 'ô
MhStr = MhStr & ",o20,o21,o22,o23,o24,o25" 'ow
MhStr = MhStr & ",d0,d1" 'dd
MhStr = MhStr & ",y00,y01,y02,y03,y04,y05" 'y
'Su dung Function Split
'De chuyen cac chuoi UniStr va MhStr sang Array
UniArr = Split(UniStr, ",")
MhArr = Split(MhStr, ",")
'Cat cac khoang trong o 2 dau cua Chuoi Unicode dua vao
UnicodeText = Trim(UnicodeText)
'Chuyen toan bo chuoi sang chu thuong
UnicodeText = LCase(UnicodeText)
'
LngSt = Len(UnicodeText)
'Duyet tu dau chuoi den cuoi chuoi
'Lay tung ky tu ra de kiem tra xem co nam trong List cuoi Unicode hay khong (UniArr)
'Neu la chuoi Unicode thi tra ky tu ma hoa tuong ung trong List chuoi ma hoa (MhArr)
For i = 1 To LngSt
SubStr = Mid(UnicodeText, i, 1) 'Tach tung ky tu ra
k = FindInArray(UniArr, SubStr) 'Xac dinh vi tri cua ky tu vua tach ra (SubStr) xem co hay khong trong UniArr
If k > 0 Then
SubStr = MhArr(k) 'Neu co trong UniArr thi lay ky tu ma hoa tuong ung trong MhArr
End If
ReStr = ReStr & SubStr 'Gan vao thanh chuoi da ma hoa
Next i
mh = ReStr
End Function
UniArr = Split(UniStr, ",")
lehongduc > 09-07-17, 05:09 PM