-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
It would be useful if ToQuantity supported long quantities in addition to int. Something like the following would work but will not honor ShowQuantityAs.Words for large positive or negative quantity values:
public static string ToQuantity(this string input, long quantity, ShowQuantityAs showQuantityAs = ShowQuantityAs.Numeric, string format = null, IFormatProvider formatProvider = null)
{
var str = quantity == 1 ? input.Singularize(false) : input.Pluralize(false);
if (showQuantityAs == ShowQuantityAs.None)
return str;
if ((showQuantityAs == ShowQuantityAs.Numeric) || (quantity > int.MaxValue) || (quantity < int.MinValue))
return string.Format(formatProvider, "{0} {1}", quantity.ToString(format, formatProvider), str);
return string.Format("{0} {1}", ((int) quantity).ToWords(), str);
}Reactions are currently unavailable