Hello,

I am trying to replace the accented letters in a given text with their 
unaccented counterparts.

What is the best way to write the following C code in Nim ?
    
    
    char p_RemoveAccent(char C)
    {
        #define ACCENT_CHARS    "ÁÀÃÂÇáàãâçÉÊéêÍíÑÓÔÕñóôõÚÜúü"
        #define UNACCENT_CHARS  "AAAACaaaacEEeeIiNOOOnoooUUuu"
        
        const char *p_Char = memchr(ACCENT_CHARS, C, sizeof(ACCENT_CHARS));
        
        return (p_Char ? UNACCENT_CHARS[(p_Char - ACCENT_CHARS)] : C);
    }
    

Is there any other optimized way to do that with Nim ?

Cheers

Reply via email to