Diacritics 3.3.29
See the version list below for details.
dotnet add package Diacritics --version 3.3.29
NuGet\Install-Package Diacritics -Version 3.3.29
<PackageReference Include="Diacritics" Version="3.3.29" />
paket add Diacritics --version 3.3.29
#r "nuget: Diacritics, 3.3.29"
// Install Diacritics as a Cake Addin #addin nuget:?package=Diacritics&version=3.3.29 // Install Diacritics as a Cake Tool #tool nuget:?package=Diacritics&version=3.3.29
Diacritics.NET
Diacritics are used across many languages in order to change the sound-values of the letters to which they are added. In software development, diacritics often have to be replaced with non-diacritics, e.g. to improve usability of user input. Diacritics.NET is a basic mapper between diacritic characters an non-diacritic characters.
Download and Install Diacritics
This library is available on NuGet: https://www.nuget.org/packages/Diacritics/ Use the following command to install Diacritics using NuGet package manager console:
PM> Install-Package Diacritics
You can use this library in any .Net project which is compatible to PCL (e.g. Xamarin Android, iOS, Windows Phone, Windows Store, Universal Apps, etc.)
API Usage
Replace diacritic characters
The most common use case of this library is to find and replace diacritic characters in a given string.
RemoveDiacritics
is a string extension method which returns a diacritics-free string.
// Arrange
const string InputString = "Je veux aller à Saint-Étienne";
// Act
string removeDiacritics = InputString.RemoveDiacritics();
// Assert
removeDiacritics.Should().Be("Je veux aller a Saint-Etienne");
Find diacritic characters
The most common use case of this library is to detect and remove diacritic characters from a given string.
If you just want to check whether a string contains diacritics, use the string extensions method HasDiacritics
.
// Arrange
const string InputString = "Je veux aller à Saint-Étienne";
// Act
bool hasDiacritics = InputString.HasDiacritics();
// Assert
hasDiacritics.Should().BeTrue();
Using Diacritics with IoC
The example shown above uses extension methods which use a default implementation of IDiacriticsMapper
, namely type DefaultDiacriticsMapper
. If you're using an IoC container, you can register IDiacriticsMapper
either with the provided DefaultDiacriticsMapper
or with your own implementation of IDiacriticsMapper
.
Add custom diactrics mappings
Diacritics is extensible. You can write your own language accent by implementing IAccentMapping
(or AccentMapping
base class). DiacriticsMapper
accepts any IAccentMapping
type at construction time.
You are highly welcome to contribute to this library. Just create a fork, commit your changes and create a pull request.
TODO: Add/Remove methods for adding/removing accents at runtime.
Benchmark Tests
Tested Version<br> https://www.nuget.org/packages/Diacritics/2.1.19291.8-pre
Benchmark Environment<br> BenchmarkDotNet=v0.11.5, OS=Windows 10.0.17134.885 (1803/April2018Update/Redstone4) Intel Core i7-7600U CPU 2.80GHz (Kaby Lake), 1 CPU, 4 logical and 2 physical cores Frequency=2835933 Hz, Resolution=352.6176 ns, Timer=TSC .NET Core SDK=3.0.100 [Host] : .NET Core 2.2.4 (CoreCLR 4.6.27521.02, CoreFX 4.6.27521.01), 64bit RyuJIT ShortRun : .NET Core 2.2.4 (CoreCLR 4.6.27521.02, CoreFX 4.6.27521.01), 64bit RyuJIT
Job=ShortRun IterationCount=3 LaunchCount=1 WarmupCount=3
Benchmark Results
Method | Mean | Error | StdDev |
---|---|---|---|
RemoveDiacritics (9 latin chars) | 230.5 ns | 476.2 ns | 26.10 ns |
RemoveDiacritics (23 diacritic chars) | 651.5 ns | 843.4 ns | 46.23 ns |
RemoveDiacritics (408 latin chars) | 8,697.1 ns | 9,938.1 ns | 544.74 ns |
RemoveDiacritics (729 diacritic chars) | 15,045.0 ns | 12,893.0 ns | 706.71 ns |
Legend<br> Mean : Arithmetic mean of all measurements<br> Error : Half of 99.9% confidence interval<br> StdDev : Standard deviation of all measurements<br> Rank : Relative position of current benchmark mean among all benchmarks (Arabic style)<br> 1 ns : 1 Nanosecond (0.000000001 sec)<br>
License
This project is Copyright © 2019 Thomas Galliker. Free for non-commercial use. For commercial use please contact the author.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.2 is compatible. netstandard1.3 was computed. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap was computed. uap10.0 was computed. |
Windows Phone | wpa81 was computed. |
Windows Store | netcore451 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.5
- No dependencies.
-
.NETStandard 1.2
- NETStandard.Library (>= 1.6.1)
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
NuGet packages (9)
Showing the top 5 NuGet packages that depend on Diacritics:
Package | Downloads |
---|---|
Jellyfin.Extensions
Package Description |
|
Dialogs
Chatbot dll |
|
SunamoFileSystem
Overall working with filesystem |
|
SunamoCollections
Working with non-generic collections |
|
SunamoDevCode
Another code mainly for working with C# in all ways. Will be in future merged with SunamoCode and SunamoCSharp. |
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on Diacritics:
Repository | Stars |
---|---|
jellyfin/jellyfin
The Free Software Media System
|
|
vesoapp/veso
Open source media server.
|
Version | Downloads | Last updated |
---|---|---|
3.3.31-pre | 88 | 10/6/2024 |
3.3.29 | 162,096 | 4/25/2024 |
3.3.28-pre | 1,662 | 3/11/2024 |
3.3.27 | 79,180 | 1/14/2024 |
3.3.26-pre | 342 | 1/14/2024 |
3.3.20-pre | 6,163 | 5/27/2023 |
3.3.19-pre | 657 | 4/18/2023 |
3.3.18 | 200,099 | 3/19/2023 |
3.3.17-pre | 874 | 12/31/2022 |
3.3.16-pre | 670 | 12/21/2022 |
3.3.15-pre | 670 | 12/18/2022 |
3.3.14 | 321,392 | 4/27/2022 |
3.3.13-pre | 712 | 4/17/2022 |
3.3.12-pre | 703 | 4/17/2022 |
3.3.11-pre | 14,415 | 1/9/2022 |
3.3.10 | 295,385 | 11/11/2021 |
3.3.9-pre | 765 | 11/11/2021 |
3.3.8-pre | 736 | 11/11/2021 |
3.3.7-pre | 729 | 11/11/2021 |
3.3.6-pre | 755 | 11/11/2021 |
3.3.4 | 37,057 | 10/7/2021 |
3.3.3-pre | 751 | 10/7/2021 |
3.2.21207.2-pre | 865 | 7/26/2021 |
3.1.20334.1-pre | 6,855 | 11/29/2020 |
3.1.20333.3-pre | 910 | 11/28/2020 |
3.0.20116.1-pre | 3,624 | 4/25/2020 |
2.1.20116.2-pre | 936 | 4/25/2020 |
2.1.20036.1 | 374,601 | 2/4/2020 |
2.1.20017.2-pre | 954 | 1/17/2020 |
2.1.19293.1 | 64,320 | 10/20/2019 |
2.1.19292.2-pre | 1,018 | 10/19/2019 |
2.1.19292.1-pre | 988 | 10/19/2019 |
2.1.19291.8-pre | 1,034 | 10/18/2019 |
2.1.19291.6-pre | 1,011 | 10/18/2019 |
2.1.19286.1-pre | 1,009 | 10/13/2019 |
2.1.19240.1-pre | 1,050 | 8/28/2019 |
2.0.19240.3 | 28,077 | 8/28/2019 |
2.0.19240.2-pre | 1,100 | 8/28/2019 |
2.0.19117.1-pre | 1,290 | 4/27/2019 |
2.0.18316.1 | 94,806 | 11/12/2018 |
2.0.18311.1 | 1,526 | 11/7/2018 |
2.0.18308.2-pre | 1,258 | 11/4/2018 |
2.0.18308.1-pre | 1,281 | 11/4/2018 |
2.0.18282.1 | 6,375 | 10/9/2018 |
2.0.18281.2-pre | 1,309 | 10/8/2018 |
2.0.18281.1-pre | 1,319 | 10/8/2018 |
1.0.8-pre1 | 1,415 | 9/5/2018 |
1.0.7 | 71,019 | 6/13/2018 |
1.0.7-pre2 | 1,425 | 6/11/2018 |
1.0.7-pre1 | 1,399 | 6/11/2018 |
1.0.6 | 7,667 | 2/21/2018 |
1.0.5 | 3,371 | 6/8/2017 |
1.0.5-pre3 | 1,475 | 4/7/2017 |
1.0.5-pre2 | 1,461 | 4/7/2017 |
1.0.5-pre1 | 1,437 | 4/7/2017 |
1.0.4 | 11,607 | 3/24/2017 |
1.0.4-pre2 | 1,510 | 3/22/2017 |
1.0.4-pre1 | 1,606 | 12/13/2016 |
1.0.3 | 3,432 | 12/13/2016 |
1.0.3-pre3 | 1,548 | 12/13/2016 |
1.0.3-pre2 | 1,536 | 4/4/2016 |
1.0.3-pre1 | 1,549 | 4/4/2016 |
1.0.2 | 19,717 | 1/28/2016 |
1.0.1 | 1,733 | 12/16/2015 |
1.0.0 | 1,907 | 12/16/2015 |
1.0.0-pre1 | 1,611 | 12/16/2015 |
3.x
- New portuguese accents (masculine or
- Continuous improvement, new diacritics mappings
- Bug fixes and performance improvements
2.1.0
- Performance improvements in RemoveDiacritics
- New method StaticDiacritics.SetDefaultMapper to replace the default IDiacriticsMapper
- Add vietnamese mappings
2.0.0
- Refactoring to NetStandard + NET 4.5.2
- Several bug fixes + new diacritics added
1.0.8
- Add Turkish ı mapping to i
1.0.7
- Support for .Net Standard 1.0
- Add Icelandic ð mapping to o
1.0.6
- Add Spanish ñ mapping to n
1.0.5
- Add support for combined cedilla characters
- Fix German ß mapping to ss
1.0.4
- Add .Net 4.5 implementation as dedicated assembly
- Add missing accents mappings
- Bug fix: Russian accents mapping fixed
1.0.3
- Bug fix: RemoveDiacritics now also removes upper case diacritic characters
- Bug fix: Correct handling of first letter upper case characters
1.0.2
- Improved initialization performance by factor 8
1.0.1
- Added ArabicAccentsMapping
- Added BulgarianAccentsMapping
- Added CatalanAccentsMapping
- Added CroatianAccentsMapping
- Added CzechAccentsMapping
- Added DutchAccentsMapping
- Added EnglishAccentsMapping
- Added EstonianAccentsMapping
- Added FilipinoAccentsMapping
- Added FrenchAccentsMapping
- Added GermanAccentsMapping
- Added GreekAccentsMapping
- Added HungarianAccentsMapping
- Added IcelandicAccentsMapping
- Added ItalianAccentsMapping
- Added LatvianAccentsMapping
- Added PolishAccentsMapping
- Added PortugueseAccentsMapping
- Added RomanianAccentsMapping
- Added RussianAccentsMapping
- Added SlovakianAccentsMapping
- Added SpanishAccentsMapping
- Added TurkishAccentsMapping
- Added UkarainianAccentsMapping