Class LanguageUtilities

Object
LanguageUtilities

public class LanguageUtilities extends Object
Utility functions for pluralizing words in strings.
Author:
Owen Feehan
  • Method Details

    • pluralizeMaybe

      public static String pluralizeMaybe(long number, String word)
      Returns something or somethings depending on the number.
      Parameters:
      number - the number n
      word - the something
      Returns:
      the string as above
    • multiplexPlural

      public static String multiplexPlural(long number, String single, String plural)
      Returns a single or plural word depending on the number.
      Parameters:
      number - the number that determines which word to use.
      single - the string to use when number is singular.
      plural - the string to use when number is pural.
      Returns:
      single or plural depending on number.
    • prefixPluralizeMaybe

      public static String prefixPluralizeMaybe(long number, String word)
      Returns 1 something or n somethings as is appropriate.
      Parameters:
      number - the number n
      word - the something
      Returns:
      the string as above
    • prefixPluralize

      public static String prefixPluralize(long number, String word)
      Returns n somethings.
      Parameters:
      number - the number.
      word - the something.
      Returns:
      the string as above.
    • pluralize

      public static String pluralize(String word)
      Given something, returns somethings.
      Parameters:
      word - the something.
      Returns:
      the string as above.