Provides number-based singular/plural string management. More...
#include <RStr.h>
Public Member Functions | |
PluralStr (const RStr &singular, const RStr &plural) | |
Initialize with the singular and plural version of a string. | |
template<class T > | |
RStr | For (T arg) const |
Provides the singular form if arg is 1, or the plural version otherwise. | |
template<class T > | |
RStr | Count (T arg) const |
For any number arg, provides the number, followed by a space, followed by the correct singular or plural form. | |
Provides number-based singular/plural string management.
Example usage: PluralStr cat("cat", "cats"); cout << cat.Count(5) << " plus one " << cat.For(1) << " is 6 " << cat.For(6); Produces: "5 cats plus one cat is 6 cats"