hung007007
Thành viên mới
- Tham gia
- 31/3/07
- Bài viết
- 40
- Được thích
- 21
Lắm khi em cần cái hàm chuyển tiếng Việt mà mỗi lần sang máy khác nó thiếu cái lọ cái chai, bực mình em viết cái hàm convert kiểu nông dân, gửi lên đây tặng các bác đỡ phải viết
PHP:
Function Uni(vnstr As String) As String
Dim sTemp$
Dim c As String, i As Integer, L As Long, iC As Long
For i = 1 To Len(vnstr)
c = Mid(vnstr, i, 1)
iC = AscW(c)
Select Case iC
Case 167: c = ChrW$(272)
Case 168: c = ChrW$(259)
Case 169: c = ChrW$(226)
Case 170: c = ChrW$(234)
Case 171: c = ChrW$(244)
Case 172: c = ChrW$(417)
Case 173: c = ChrW$(432)
Case 174: c = ChrW$(273)
Case 181: c = ChrW$(224)
Case 182: c = ChrW$(7843)
Case 183: c = ChrW$(227)
Case 184: c = ChrW$(225)
Case 185: c = ChrW$(7841)
Case 187: c = ChrW$(7857)
Case 188: c = ChrW$(7859)
Case 189: c = ChrW$(7861)
Case 190: c = ChrW$(7855)
Case 198: c = ChrW$(7863)
Case 199: c = ChrW$(7847)
Case 200: c = ChrW$(7849)
Case 201: c = ChrW$(7851)
Case 202: c = ChrW$(7845)
Case 203: c = ChrW$(7853)
Case 204: c = ChrW$(232)
Case 206: c = ChrW$(7867)
Case 207: c = ChrW$(7869)
Case 208: c = ChrW$(233)
Case 209: c = ChrW$(7865)
Case 210: c = ChrW$(7873)
Case 211: c = ChrW$(7875)
Case 212: c = ChrW$(7877)
Case 213: c = ChrW$(7871)
Case 214: c = ChrW$(7879)
Case 215: c = ChrW$(236)
Case 216: c = ChrW$(7881)
Case 220: c = ChrW$(297)
Case 221: c = ChrW$(237)
Case 222: c = ChrW$(7883)
Case 223: c = ChrW$(242)
Case 225: c = ChrW$(7887)
Case 226: c = ChrW$(245)
Case 227: c = ChrW$(243)
Case 228: c = ChrW$(7885)
Case 229: c = ChrW$(7891)
Case 230: c = ChrW$(7893)
Case 231: c = ChrW$(7895)
Case 232: c = ChrW$(7889)
Case 233: c = ChrW$(7897)
Case 234: c = ChrW$(7901)
Case 235: c = ChrW$(7903)
Case 236: c = ChrW$(7905)
Case 237: c = ChrW$(7899)
Case 238: c = ChrW$(7907)
Case 239: c = ChrW$(249)
Case 241: c = ChrW$(7911)
Case 242: c = ChrW$(361)
Case 243: c = ChrW$(250)
Case 244: c = ChrW$(7909)
Case 245: c = ChrW$(7915)
Case 246: c = ChrW$(7917)
Case 247: c = ChrW$(7919)
Case 248: c = ChrW$(7913)
Case 249: c = ChrW$(7921)
Case 250: c = ChrW$(7923)
Case 251: c = ChrW$(7927)
Case 252: c = ChrW$(7929)
Case 253: c = ChrW$(253)
Case 254: c = ChrW$(7925)
End Select
sTemp = sTemp + c
Next i
Uni = Trim(sTemp)
End Function