/// <summary>
 /// Singularizes a word
 /// </summary>
 /// <param name="Word">Word to singularize</param>
 /// <param name="Culture">Culture info used to singularize the word (defaults to current culture)</param>
 /// <returns>The word singularized</returns>
 public static string Singularize(this string Word, CultureInfo Culture = null)
 {
     if (Word.IsNullOrEmpty())
         return "";
     Culture = Culture.NullCheck(CultureInfo.CurrentCulture);
     return PluralizationService.CreateService(Culture).Singularize(Word);
 }
 /// <summary>
 /// Returns the first day of a week based on the date sent in
 /// </summary>
 /// <param name="Date">Date to get the first day of the week from</param>
 /// <param name="CultureInfo">The culture to use (defaults to current culture)</param>
 /// <returns>The first day of the week</returns>
 public static DateTime FirstDayOfWeek(this DateTime Date,CultureInfo CultureInfo=null)
 {
     Date.ThrowIfNull("Date");
     return Date.AddDays(CultureInfo.NullCheck(CultureInfo.CurrentCulture).DateTimeFormat.FirstDayOfWeek - Date.DayOfWeek).Date;
 }
 /// <summary>
 /// Returns the last day of a week based on the date sent in
 /// </summary>
 /// <param name="Date">Date to get the last day of the week from</param>
 /// <param name="CultureInfo">The culture to use (defaults to current culture)</param>
 /// <returns>The last day of the week</returns>
 public static DateTime LastDayOfWeek(this DateTime Date, CultureInfo CultureInfo = null)
 {
     Date.ThrowIfNull("Date");
     return Date.FirstDayOfWeek(CultureInfo.NullCheck(CultureInfo.CurrentCulture)).AddDays(6);
 }
Exemplo n.º 4
0
 /// <summary>
 ///     Pluralizes a word
 /// </summary>
 /// <param name="word">Word to pluralize</param>
 /// <param name="culture">Culture info used to pluralize the word (defaults to current culture)</param>
 /// <returns>The word pluralized</returns>
 public static string Pluralize(this string word, CultureInfo culture = null)
 {
     if (word.IsNullOrEmpty())
         return "";
     culture = culture.NullCheck(CultureInfo.CurrentCulture);
     return PluralizationService.CreateService(culture).Pluralize(word);
 }