在Windows 7上使用MS Access 2003中,我發現下面這個函數去除從ANSI字符串的所有口音,改變(例如)閱兵式,以SENOR:插入Unicode字符爲VBA字符串
Public Function RemoveAccents(ByVal inputString As String) As String
Const accentString As String = "ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÏÑÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðñòóóôõöùúûüýÿ"
Const nonAccentStr As String = "AAAAAACEEEEIIIIINOOOOOUUUUYaaaaaaceeeeiiiionoooooouuuuyy"
Dim i As Integer
For i = 1 To Len(accentString)
inputString = Replace(inputString, Mid(accentString, i, 1), Mid(nonAccentStr, i, 1), , , vbBinaryCompare)
Next i
RemoveAccents = inputString
End Function
但是,當我試圖與卡隆(U-010D)(č)(HTML č)添加拉丁文小寫字母C的功能常量accentString,這樣,
Const accentString As String = "ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÏÑÒÓÔÕÖÙÚÛÜÝàáâãäåç" & ChrW$(&H10D) & "èéêëìíîïðñòóóôõöùúûüýÿ"
Const nonAccentStr As String = "AAAAAACEEEEIIIIINOOOOOUUUUYaaaaaacceeeeiiiionoooooouuuuyy"
我無法運行該功能。有沒有一種語法可以讓我調整這個函數以從包含不在ANSI字符集中的字符的字符串中去除變音符號?
嘖嘖,即使我只說英語,住在通常是同質的美國,但我仍然需要處理Unicode字符,這個問題幫助了我。 – GlennFromIowa 2016-07-06 15:27:12