Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove redundant ToQuantityExtensions overloads #1338

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1626,10 +1626,8 @@ namespace Humanizer
public static class ToQuantityExtensions
{
public static string ToQuantity(this string input, double quantity) { }
public static string ToQuantity(this string input, int quantity, Humanizer.ShowQuantityAs showQuantityAs = 1) { }
public static string ToQuantity(this string input, long quantity, Humanizer.ShowQuantityAs showQuantityAs = 1) { }
public static string ToQuantity(this string input, double quantity, string format = null, System.IFormatProvider formatProvider = null) { }
public static string ToQuantity(this string input, int quantity, string format, System.IFormatProvider formatProvider = null) { }
public static string ToQuantity(this string input, long quantity, string format, System.IFormatProvider formatProvider = null) { }
}
public static class TruncateExtensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1007,10 +1007,8 @@ namespace Humanizer
public static class ToQuantityExtensions
{
public static string ToQuantity(this string input, double quantity) { }
public static string ToQuantity(this string input, int quantity, Humanizer.ShowQuantityAs showQuantityAs = 1) { }
public static string ToQuantity(this string input, long quantity, Humanizer.ShowQuantityAs showQuantityAs = 1) { }
public static string ToQuantity(this string input, double quantity, string format = null, System.IFormatProvider formatProvider = null) { }
public static string ToQuantity(this string input, int quantity, string format, System.IFormatProvider formatProvider = null) { }
public static string ToQuantity(this string input, long quantity, string format, System.IFormatProvider formatProvider = null) { }
}
public static class TruncateExtensions
Expand Down
35 changes: 0 additions & 35 deletions src/Humanizer/ToQuantityExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,41 +29,6 @@ public enum ShowQuantityAs
/// </summary>
public static class ToQuantityExtensions
{
/// <summary>
/// Prefixes the provided word with the number and accordingly pluralizes or singularizes the word
/// </summary>
/// <param name="input">The word to be prefixed</param>
/// <param name="quantity">The quantity of the word</param>
/// <param name="showQuantityAs">How to show the quantity. Numeric by default</param>
/// <example>
/// "request".ToQuantity(0) => "0 requests"
/// "request".ToQuantity(1) => "1 request"
/// "request".ToQuantity(2) => "2 requests"
/// "men".ToQuantity(2) => "2 men"
/// "process".ToQuantity(1200, ShowQuantityAs.Words) => "one thousand two hundred processes"
/// </example>
public static string ToQuantity(this string input, int quantity, ShowQuantityAs showQuantityAs = ShowQuantityAs.Numeric)
{
return input.ToQuantity(quantity, showQuantityAs, format: null, formatProvider: null);
}

/// <summary>
/// Prefixes the provided word with the number and accordingly pluralizes or singularizes the word
/// </summary>
/// <param name="input">The word to be prefixed</param>
/// <param name="quantity">The quantity of the word</param>
/// <param name="format">A standard or custom numeric format string.</param>
/// <param name="formatProvider">An object that supplies culture-specific formatting information.</param>
/// <example>
/// "request".ToQuantity(0) => "0 requests"
/// "request".ToQuantity(10000, format: "N0") => "10,000 requests"
/// "request".ToQuantity(1, format: "N0") => "1 request"
/// </example>
public static string ToQuantity(this string input, int quantity, string format, IFormatProvider formatProvider = null)
{
return input.ToQuantity(quantity, showQuantityAs: ShowQuantityAs.Numeric, format: format, formatProvider: formatProvider);
}

/// <summary>
/// Prefixes the provided word with the number and accordingly pluralizes or singularizes the word
/// </summary>
Expand Down