How to program with PluralizationService in C#?

Rajnilari2015
Posted by Rajnilari2015 under C# category on | Points: 40 | Views : 1294
class Program
{
static void Main(string[] args)
{
//creates an instance of the service
PluralizationService ps = PluralizationService.CreateService(CultureInfo.GetCultureInfo("en-us"));

//check if the supplied word is plural
var isPlural = ps.IsPlural("mangoes"); //true

//check if the supplied word is singular
var isSingular = ps.IsSingular("mangoe"); //true

//change a singular word to plural
var pluralWord = ps.Pluralize("boy"); //result: boys

//change a plural word to singular
var singularWord = ps.Singularize("girls"); //result: girl


}
}

Comments or Responses

Login to post response