How do I remove diacritics (accents) from a string in .NET?

前端 未结 20 2913
南方客
南方客 2020-11-21 05:44

I\'m trying to convert some strings that are in French Canadian and basically, I\'d like to be able to take out the French accent marks in the letters while keeping the lett

20条回答
  •  逝去的感伤
    2020-11-21 06:14

    you can use string extension from MMLib.Extensions nuget package:

    using MMLib.RapidPrototyping.Generators;
    public void ExtensionsExample()
    {
      string target = "aácčeéií";
      Assert.AreEqual("aacceeii", target.RemoveDiacritics());
    } 
    

    Nuget page: https://www.nuget.org/packages/MMLib.Extensions/ Codeplex project site https://mmlib.codeplex.com/

提交回复
热议问题