Removing accents from letters

Hello,

I was wondering if there was a function which takes as input a string and returns the same string stripped of any accents (ex: été -> ete). If not, what would be the most efficient way of achieving this result within an expression rule?

Thank you

  Discussion posts and replies are publicly visible

  • a!localVariables(
      local!splitted_text: a!forEach(
        items: enumerate(len(ri!text)),
        expression: charat(ri!text, fv!index)
      ),
      local!splCharsReplacedArray_txt: a!forEach(
        items: local!splitted_text,
        expression: if(
          isnull(clean(fv!item)),
          displayvalue(
            fv!item,
            {"à","á","â","ã","ä","ç","è","é","ê","ë","ì","í","î","ï","ñ","ò","ó","ô","õ","ö","š","ù","ú","û","ü","ý","ÿ","ž","À","Á","Â","Ã","Ä","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ñ","Ò","Ó","Ô","Õ","Ö","Š","Ú","Û","Ü","Ù","Ý","Ÿ","Ž"},
            {"a","a","a","a","a","c","e","e","e","e","i","i","i","i","n","0","o","o","o","o","s","u","u","u","u","y","y","z","A","A","A","A","A","C","E","E","E","E","I","I","I","I","N","O","O","O","O","O","S","U","U","U","U","Y","Y","Z"},
            ""),
          fv!item
        )
      ),
      joinarray(local!splCharsReplacedArray_txt, "")
    )
    This is what I have so far but it seems very inefficient 

  • 0
    Certified Lead Developer
    in reply to louisg1563

    a!localVariables(
      local!keys: {
        "à",
        "á",
        "â",
        "ã",
        "ä",
        "ç",
        "è",
        "é",
        "ê",
        "ë",
        "ì",
        "í",
        "î",
        "ï",
        "ñ",
        "ò",
        "ó",
        "ô",
        "õ",
        "ö",
        "š",
        "ù",
        "ú",
        "û",
        "ü",
        "ý",
        "ÿ",
        "ž",
        "À",
        "Á",
        "Â",
        "Ã",
        "Ä",
        "Ç",
        "È",
        "É",
        "Ê",
        "Ë",
        "Ì",
        "Í",
        "Î",
        "Ï",
        "Ñ",
        "Ò",
        "Ó",
        "Ô",
        "Õ",
        "Ö",
        "Š",
        "Ú",
        "Û",
        "Ü",
        "Ù",
        "Ý",
        "Ÿ",
        "Ž"
      },
      local!values: {
        "a",
        "a",
        "a",
        "a",
        "a",
        "c",
        "e",
        "e",
        "e",
        "e",
        "i",
        "i",
        "i",
        "i",
        "n",
        "0",
        "o",
        "o",
        "o",
        "o",
        "s",
        "u",
        "u",
        "u",
        "u",
        "y",
        "y",
        "z",
        "A",
        "A",
        "A",
        "A",
        "A",
        "C",
        "E",
        "E",
        "E",
        "E",
        "I",
        "I",
        "I",
        "I",
        "N",
        "O",
        "O",
        "O",
        "O",
        "O",
        "S",
        "U",
        "U",
        "U",
        "U",
        "Y",
        "Y",
        "Z"
      },
      reduce(
        substitute(_, _, _),
        ri!text,
        merge(local!keys, local!values)
      )
    )

  • 0
    Certified Lead Developer
    in reply to louisg1563

    I have my doubts that there is a easy or simple solution to this. E.g. the German "ü" needs to be replaced by "ue" and I think that other languages have something similar in place.

    BTW, the most simple way to turn a text into a list of characters is char(code(ri!text))