Skip to content

anth12/diacritical-dotnet

Repository files navigation

Diacritical.Net

.NET Standard library to replace Diacritic characters with ASCII equivalents.

Diacritical logo

Build Status Nuget Downloads

Getting Started

Install the (nuget):

PM> Install-Package Diacritical.Net

> dotnet add package Diacritical.Net

Usage

"Buen día".RemoveDiacritics();      // Buen dia
"Witaj świecie".RemoveDiacritics(); // Witaj swiecie

"Olá Mundo".HasDiacritics();   // true
"Hello World".HasDiacritics(); // false

Sample mappings

  • Á,Ă,Ắ,Ặ,Ằ,Ẳ,Ẵ,Ǎ,Â... -> A
  • á,ă,ắ,ặ,ằ,ẳ,ẵ,ǎ,â... -> a
  • Æ,Ǽ,Ǣ -> AE
  • é,ĕ,ě,ȩ,ḝ,ê,ế,ệ,ề... -> e
  • Ó,Ŏ,Ǒ,Ô,Ố,Ộ,Ồ,Ổ,Ỗ... -> O
  • Ś,Ṥ,Š,Ṧ,Ş,Ŝ,Ș,Ṡ,Ṣ... -> S
  • ...

A full list of supported mappings can be found here.

Custom mappings can easily be added with a custom IDiacriticProvider implementation and registered with:

DiacriticMap.AddProvider(new MyCustomDiacriticProvider());

Credits

  • Logo eraser icon by Terrence Kevin Oleary (noun project)
  • Diacritic mappings from diacritics/database

Releases

No releases published

Packages

No packages published

Languages