Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ashrafsada/pluralizecore
https://github.com/ashrafsada/pluralizecore
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/ashrafsada/pluralizecore
- Owner: AshrafSada
- License: mit
- Created: 2024-03-01T20:57:09.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-03-12T04:25:34.000Z (10 months ago)
- Last Synced: 2024-11-16T16:15:55.457Z (about 2 months ago)
- Language: C#
- Size: 46.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pluralize Core
This is an updated package from [Pluralize.NET](https://github.com/sarathkcm/Pluralize.NET) so it can now be used for Net Core.
## What is Pluralize.Core?
(Originally) Pluralize.NET is a small C# library to pluralize and singularize English words.
## How to use it?
Package manage console:
```powershell
PM> Install-Package Pluralize.Core
```Dotnet cli:
```shell
dotnet add package Pluralize.Core
```Include the namespace:
```Csharp
using Pluralize.Core;
```write the code:
```csharp
IPluralize pluralizer = new Pluralizer();pluralizer.Singularize("Horses"); //=> "Horse"
pluralizer.Pluralize("Horse"); //=> "Horses"// Example of new plural rule:
pluralizer.Pluralize("regex"); //=> "regexes"
pluralizer.AddPluralRule(new Regex("gex$"), "gexii");
pluralizer.Pluralize("regex"); //=> "regexii"// Example of new singular rule:
pluralizer.Singularize('singles'); //=> "single"
pluralizer.AddSingularRule(new Regex("singles"), 'singular');
pluralizer.Singularize('singles'); //=> "singular"// Example of new irregular rule, e.g. "I" -> "we":
pluralizer.Pluralize('irregular'); //=> "irregulars"
pluralizer.AddIrregularRule('irregular', 'regular');
pluralizer.Pluralize('irregular'); //=> "regular"// Example of uncountable rule (rules without singular/plural in context):
pluralizer.Pluralize('paper'); //=> "papers"
pluralizer.AddUncountableRule('paper');
pluralizer.Pluralize('paper'); //=> "paper"// Example of asking whether a word looks singular or plural:
pluralizer.IsPlural('test'); //=> false
pluralizer.IsSingular('test'); //=> true// Example of formatting a word based on count
pluralizer.Format(5, "dog"); // => "dogs"
pluralizer.Format(5, "dog", inclusive: true); // => "5 dogs"
```### Supported .Net Versions
- .Net Core 6.0
- .Net Core 7.0
- .Net Core 8.0The library may work for other .Net versions, but as it is not maintained by the original author, I cannot ensure its compatibility with every version. Working with .Net 6, 7, and 8. If you found a compatibility problem, I appreciate [creating an issue in this repo](https://github.com/AshrafSada/PluralizeNetCore/issues/new/choose).
### License
Original license [MIT](https://github.com/sarathkcm/Pluralize.NET/blob/master/LICENCE).
### Contributors :sparkles:
| ||| |
|--|--|--|--|
|[Ashraf Sada](https://github.com/AshrafSada)|[Daniel Destouche](https://www.linkedin.com/in/daniel-destouche/)| [Sarath Kumar CM](https://github.com/sarathkcm)| [Dennis Pražák](https://sorashi.github.io/) |