How to sanitize for ascii characters only

Hi, I was wondering how to sanitize a string to contain ASCII characters only.
As there are no methods for doing so directly I just wanted to share my UDF

I’m not sure it takes 100% of non-ascii symbols but it should be enough for most of us.

Query(
  Lambda(
    ["str"],
    ReplaceStrRegex(
      ReplaceStrRegex(
        ReplaceStrRegex(
          ReplaceStrRegex(
            ReplaceStrRegex(
              ReplaceStrRegex(
                ReplaceStrRegex(
                  ReplaceStrRegex(Var("str"), "[àâªæáäãåā]", "a"),
                  "[éèêëęėē]",
                  "e"
                ),
                "[ÿ]",
                "y"
              ),
              "[ûùüúū]",
              "u"
            ),
            "[îïìííįī]",
            "i"
          ),
          "[ôœºööòóõøō]",
          "o"
        ),
        "[çćč]",
        "c"
      ),
      "[ñń]",
      "n"
    )
  )
)
1 Like