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)
    Next
    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,"+
    "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,y";",");
    thestring:="Déjà nettoyé cette fenêtre?";
    @Prompt([OK];thestring;@ReplaceSubstring(thestring;AccChars;RegChars));

Hope you can use it someday. Let me know.

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