在 Windows 7 上使用 MS Access 2003,我发现以下函数会从 ANSI 字符串中去除所有重音符号,将(例如)señor 更改为 senor:
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
但是当我尝试将带有 Caron (U-010D)(č)(HTML č) 的拉丁文小写字母 C 添加到函数 Const 重音字符串中时,像这样,
Const accentString As String = "ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÏÑÒÓÔÕÖÙÚÛÜÝàáâãäåç" & ChrW$(&H10D) & "èéêëìíîïðñòóóôõöùúûüýÿ"
Const nonAccentStr As String = "AAAAAACEEEEIIIIINOOOOOUUUUYaaaaaacceeeeiiiionoooooouuuuyy"
我无法运行该功能。是否有一种语法可以让我调整此函数以从包含不在 ANSI 字符集中的字符的字符串中去除变音符号?