SnTT.gifYesterday I needed a function to remove all accents from the accented characters in a string. I googled a bit, but did not find a clean solution. I needed it for Excel, but supposed it might be useful in Notes too.
So here's the function for 3 environments:

  • for Excel and Lotusscript
    Yes, they are the same (there are other solution too, certainly in Lotusscript, but I wanted to make is simple).
    Function StripAccent(thestring As String)
    Dim A As String * 1
    Dim B As String * 1
    Dim i As Integer

    Const AccChars= "ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðñòóôõöùúûüýÿ"
    Const RegChars= "SZszYAAAAAACEEEEIIIIDNOOOOOUUUUYaaaaaaceeeeiiiidnooooouuuuyy"

    For i = 1 To Len(AccChars)
    A = Mid(AccChars, i, 1)
    B = Mid(RegChars, i, 1)
    thestring = Replace(thestring, A, B)
    StripAccent = thestring
    End Function
  • in Formula Language
    AccChars := @Explode("Š,Ž,š,ž,Ÿ,À,Á,Â,Ã,Ä,Å,Ç,È,É,Ê,Ë,Ì,Í,Î,Ï,Ð,Ñ,Ò,Ó,Ô,Õ,Ö,Ù,Ú,Û,Ü,Ý,"+
    RegChars := @Explode("S,Z,s,z,Y,A,A,A,A,A,A,C,E,E,E,E,I,I,I,I,D,N,O,O,O,O,O,U,U,U,U,Y,"+
    thestring:="Déjà nettoyé cette fenêtre?";

Hope you can use it someday. Let me know.

Category:  Domino/Notes  Microsoft Excel  | TechnoratiTechnorati: , ,