0 Replies - 946 Views - Last Post: 12 June 2007 - 05:24 AM

#1 Chubber  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 131
  • Joined: 16-October 06

StripAccents

Posted 12 June 2007 - 05:24 AM

Description: I used this when I have to send data to non-compliant processes, like mail order houses. Strip any accented characters from a string, replacing them with the non-accented versions.
Function StripAccents(strIn) 
    Dim strOut 
    Dim strMid 
    Dim n 
    strIn = Trim(strIn)
    For n = 1 To Len(strIn)
        strMid = Mid(strIn, n, 1)
        Select Case Asc(strMid)
        Case 138:
            strMid = "S"
        Case 140:
            strMid = "CE"
        Case 142:
            strMid = "Z"
        Case 154:
            strMid = "s"
        Case 156:
            strMid = "oe"
        Case 158:
            strMid = "z"
        Case 159:
            strMid = "Y"
        Case 181:
            strMid = "u"
        Case 192, 193, 194, 195, 196, 197:
            strMid = "A"
        Case 198:
            strMid = "AE"
        Case 199:
            strMid = "C"
        Case 200, 201, 202, 203:
            strMid = "E"
        Case 204, 205, 206, 207:
            strMid = "I"
        Case 208:
            strMid = "D"
        Case 209:
            strMid = "N"
        Case 210, 211, 212, 213, 214, 216:
            strMid = "O"
        Case 215:
            strMid = "x"
        Case 217, 218, 219, 220:
            strMid = "U"
        Case 221:
            strMid = "Y"
        Case 222, 254:
            strMid = "p"
        Case 223:
            strMid = "B"
        Case 224, 225, 226, 227, 228, 229:
            strMid = "a"
        Case 230:
            strMid = "ae"
        Case 231:
            strMid = "c"
        Case 232, 233, 234, 235:
            strMid = "e"
        Case 236, 237, 238, 239:
            strMid = "i"
        Case 240, 242, 243, 244, 245, 246, 248:
            strMid = "o"
        Case 241:
            strMid = "n"
        Case 249, 250, 251, 252:
            strMid = "u"
        Case 253, 255:
            strMid = "y"
        End Select
        strOut = strOut + strMid
    Next
    StripAccents = strOut
End Function


Is This A Good Question/Topic? 0
  • +

Page 1 of 1