Is there any algorithm in c# to singularize - pluralize a word (in english) or does exist a .net library to do this (may be also in different languages)?
I cheated in Java - I wanted to be able to produce a correct string for "There were n something(s)", so I wrote the foll. little overloaded utility method:
static public String pluralize(int val, String sng) {
return pluralize(val,sng,(sng+"s"));
}
static public String pluralize(int val, String sng, String plu) {
return (val+" "+(val==1 ? sng : plu));
}
invoked like so
System.out.println("There were "+pluralize(count,"something"));
System.out.println("You have broken "+pluralize(count,"knife","knives"));