More Features in Pluralizer

If you haven't read the introduction to Pluralizer, I'd suggest checking it out first. Here are a few more things that Pluralizer can do, if you find the need arises.

Format Numbers

Whenever you're writing the number itself (i.e. using the {_} placeholder), you can format it like you would if you were using String.Format. To do this, start the placeholder as usual, but after the underscore, type a colon then any of the Standard Numeric Format Strings. The format is this {_:FormatString}. For example:

var str = "At $1 each, the total for {_} {piece} will be {_:C}.";

var single = Pluralizer.Instance.Pluralize(str, 1);
Assert.AreEqual("At $1 each, the total for 1 piece will be $1.00.", single);

var plural = Pluralizer.Instance.Pluralize(str, 42);
Assert.AreEqual("At $1 each, the total for 42 pieces will be $42.00.", plural);


  • this will only work for the special number placeholder (i.e. the underscore)
  • advanced numeric formats like hex (i.e. {_:X}) and positive;negative;zero (i.e. {_:0;(0);zero}) should also work but they don't yet. I'm on it.

Multiple Numbers

You may also find the need to use more than one number to decide the singular/plural state of your placeholders. To accomplish this, you'll pass them in as an array of numbers (instead of just one number), and you'll add what we'll call an "index prefix" (the index followed by a pipe) as the first part of the placeholders. The format is this {IndexPrefix|SingularWordOrUnderScore} or {IndexPrefix|SingularWord|PluralWord} or {IndexPrefix|Underscore:FormatString}

var str = "At {0|_:C} each, the total for {1|_} {1|piece} will be {2|_:C}.";

var actual = Pluralizer.Instance.Pluralize(str, new[] { 1.15, 4, 4.6 });
Assert.AreEqual("At $1.15 each, the total for 4 pieces will be $4.60.", actual);

actual = Pluralizer.Instance.Pluralize(str, new[] { 78.15, 1, 78.15 });
Assert.AreEqual("At $78.15 each, the total for 1 piece will be $78.15.", actual);


  • You can use these "index prefixes" on a number placeholder, along with the format string
  • if no "index prefix" is present, then 0 is assumed

That's a little more info on some of the things that are supported by Pluralizer.

I Want It!

You can get it at via NuGet, or go to my main Pluralizer page for more info.